Gridview is not updating
This example shows how to edit and update records in a Grid View in ASP. This example is helpful in situations where an administrator needs to edit several records from the database.
For demonstration I have created a database (named Database.mdf) in which we have a table named tbl_Employee.
Use the approach demonstrated in this help article.
I have a Grid View with a couple of Template Fields. My Grid View: Auto Generate Delete Button="True" Auto Generate Edit Button="True" Cell Padding="3" Grid Lines="Horizontal" Data Source ID="sds Vans" Data Key Names="Van Id" Auto Generate Columns="False" Css Class="wa Grid View" Allow Paging="True" Show Footer="true" Horizontal Align="Center"" Select Command="SELECT Van Id, Vendor Van No, Vendor Code, Start Date, End Date, Status, Active FROM dbo. Vans set Vendor Van [email protected] Van No, Vendor [email protected] Code, [email protected], [email protected], Start [email protected] Date, End [email protected] Date where Van [email protected] Id" Delete Command="Delete from dbo.
The problem is that the Grid View is not updated and removing item's if I set the property 'Is Eco Generated' to true on one (or several) of the items.
How do i achieve this in MVVM pattern as i cant access my Rad Grid View directly.
I am using a Paged Collection View or Observable Collection to bind data to Rad Grid View.
As an alternative, you could set the Update Mode parameter to "Always" (which is the default) to allow any web control that triggers a postback to automatically update the Grid View.
This saves you a few lines of code (configuring the triggers) but will also help if you dynamically add controls to your Grid View that will also trigger postback events on your page.