I have been trying to find a solution for this for a while but I've only managed to find junk on outdated forums.
I am using VB6 and I want to display data in a tabular form. I thought about using a DataGrid but I can't figure out how to add rows to the grid.
Note: The DataGrid is not bound to a recordset.
Is there any way to add the data to the GridView without storing it in a recordset. And is there a better VB6 control to use in this situation?
DataGrids are designed to be used bound to a data source, though it can be a custom data source object and not just an ADO Recordset.
For general display you might want to use the MSHFlexGrid (or the VB5 holdover MSFlexGrid).
Related
What you'Il often find when using a dynamically expandeable grid like Teleriks RadGrid or Kendo's Grid is that the more columns you offer to the user the more data needs to pulled in and the more heavier the query becomes. This happens partially because the grids don't pass the selected columns to the data source.
For example, if we have a Product with many components, locations, and other properties, we prefer not to pull in the properties we don't need.
In what way can the problem of needing to pull in so many data be mitigated? Is it possible to pass the selected columns to the data source? Or can the fields be loaded afterwards via a seperate AJAX call?
I know RadGrid and Kendo Grid are two completely different technologies but I'm interested in the answer to both. I'm sure someone must have seen the same issue with these types of grids.
One way to mitigate the problem is to apply server-side paging to the grid - that way only the data required will go over the wire. Generally the problem with data volume in grids is the rows rather than the columns.
Also, make sure the data source is being queried efficiently, particularly where you are joining data from different tables in your data source.
I've read tons of sites on this. There are many "Examples" if you call some code with no explanation of how it was generated (design view vs typed) an example or just want to use simple select and update statements.
I have a Gridview. I am populating it using code from a stored proc. Now I want to edit the data. I have nothing set in the properties of the Gridview through design view (datasource, columns, etc.) My question is, how can I set this to allow editing and use a SP to send it back to the database?
Do I have to now manually create columns with code since I chose to not set properties in the design view?
Is it better to set the properties in design view and go that route? I started that way, but had problems when it came to updating with a SP.
I guess the whole do it in the designer vs do it in code thing has me confused.
I started adding RowEdit, RowCommand, etc. to the html and c#, but still don't see the EDIT/CANCEL on the webpage when I run it.
Learn to use the ObjectDataSource. It gives you maximum freedom of what way of storing the data you use - you delegate the select, update and delete to an external class where you just write your code which uses ado, linq, hibernate, a webservice or just anything.
Coding your views directly against fixed database structure would hurt you sooner or later.
I am looking for some examples for gridview for common tasks like displaying, editing, deleting, paging, sorting, batch updates etc, but WITHOUT using any datasource controls. I would like to bind the data in the code to custom object collection. all the samples I found on the web so far use some data source control, I think Enterprise applications shouldn't be using this pattern. objects in my solution have only business logic and no data access code. instead I use manager objects to do this.
if you have any examples of gridview that performs the common tasks without using any data source control, can you please share them? that would be very helpful. thanks.
Editable GridView in ASP.NET 2.0
Sorting a GridView Bound to a Custom Data Object
I am attempting to construct a formview that will edit two related objects at once.
In basic terms, I have a Linq To SQL object of teacher which has exactly one school. The formview has no problem displaying the data, but when in edit mode will only save the changes done to the parent object. Changes to the school data are seemingly ignored
Is there any way to achieve the kind of thing I want here?
Thanks,
This is probably similar to what I'm doing, although I'm not using Linq. I'm using a vanilla ObjectDataSource and displaying data in a drop down list via a different data source. Add a new Event for the FormView that is called during the "ItemUpdating" event. Embed code to directly save your changes in that event. Then as the FormView is saved, everything else is saved.
If you want it to be saved after the FormView, use the ItemUpdated event instead. It's a bit of a manual process, but it does get around the problem.
I've been spoiled by the SqlDataSource, but I'm in a scenario where I can't use it. Is there an alternative to GridView that implements sorting and paging for arbitrary data sources? I'm trying to avoid writing 1000s of lines of custom paging and sorting for each grid. At the office I use Telerik's grid, but for my hobby project, spending that much money is out of the question.
EDIT: It just seems to a lazy programmer like me that if I connect a grid and a data source it should automatically page and sort. So I'm looking for combinations of datasources + grids that result in code-less paging and sorting.
So far the only examples I know of are Telerik's grid (cost $, implements sorting and paging in the grid) and SqlDataSource + GridView (implements sorting and paging in the DataSource, but requires MS-SQL to be available)
I'm not sure if you are asking for an alternate to the GridView or the SqlDataSource....
But you can always use an ObjectDataSource and connect it to any bindable object, collection or Dataset
http://msdn.microsoft.com/en-us/library/aa479347.aspx
We never use a SqlDataSource, we use a wrapper for a SQL call out of our data layer, or use a collection in the ODS.