Manually Populating Grids
-
I'm trying to manually populate a GridView on a web form. I know how to populate it using a DataSource control, but I cannot get the desired effects using the automatic features. My scenario: I have a DataTable persisting on server side memory. I want to populate a grid of products once per session, but have the table persist and used by every session. I have worked out an algorithm to do this using manual population, but cannot get the grid populated (used to VB6). Should I find a way to use automatic population with a DataSource, or is there an easy way to populate the grid? Is GridView the wrong control for what I want to do? Thanks in advance, Pualee
-
I'm trying to manually populate a GridView on a web form. I know how to populate it using a DataSource control, but I cannot get the desired effects using the automatic features. My scenario: I have a DataTable persisting on server side memory. I want to populate a grid of products once per session, but have the table persist and used by every session. I have worked out an algorithm to do this using manual population, but cannot get the grid populated (used to VB6). Should I find a way to use automatic population with a DataSource, or is there an easy way to populate the grid? Is GridView the wrong control for what I want to do? Thanks in advance, Pualee
-
Store the DataTable inside the Application object on your web form do: MyDataGrid.DataSource = myDataTable.DefaultView; myDataGrid.DataBind(); 1 line of code equals many bugs. So don't write any!!
Many thanks! I actually had a realization that was similar to this. I noticed that I can use a DataTable for the DataSource, rather than another control. With the data table, I can filter and change the table as necessary before updating the GridView :-) Thus, the GridView will display my table as desired. Pualee