Aspx gridview updating
Edit Item Template: When we select or edit a specific row, the contents of this templates are displayed in the gridview.
Mainly used when we edit a particular row in the gridview control.
This is the easy way to handle all the gridview operations in data base side instead of using sql query from front end side.Suppose we’ve to work on Customer table having Category ID as foreign key.Next Select your database and Set “Save Entity connection string in Web.config as” option true giving name Sample Entities.When i click the update, or delete button, it makes a Post Back, but nothing is affected. I have also tried adding the columns manually, but no affect here either. I'm sure this has got something to do with the parameters. The code for setting the commands, and adding the Sql Data Source to the page are as follows: string str Conn = Configuration Manager. Connection String; string str Provider = Configuration Manager. Provider Name; string select Command = "SELECT * FROM rammekategori"; Sql Data Source ds = new Sql Data Source(str Provider, str Conn, select Command); ds. Update Command = "UPDATE rammekategori SET Kategoribeskrivelse = @Kategoribeskrivelse WHERE (Kategorinavn = @Kategorinavn)"; ds.
Delete Command = "DELETE FROM rammekategori WHERE (Kategorinavn = @Kategorinavn)"; Parameter Kategorinavn = new Parameter("Kategorinavn", Type Code.