people store dating - Gridview not updating

When Update link of the Grid View will be clicked (in edit mode), On Row Updating event will fire that will call Update Record method.In this method, we have to get changed values of Text Box and Drop Down list and also we need the primary key value for the record that is being edited.

gridview not updating-76

For Page Name and Page Description field I want them to appear in the Text Box in edit view, so I have specified text property of Text Box as the field value in Edit Item Template and for Active field, I want it to appear as the Drop Down List so I have specified the Selected Value property as the value of the Active field.

You may notice that the last column of the Grid View is a Delete column that let user delete the record from database, so I have placed Delete link button inside the tag and have specified on Click property as Java Script confirm return value, so that when user clicks on it he/she sees a confirmation box whether he/she really wants to delete the record.

In our initial form, We've set a dynaform grid element, assigned it to a variable, which populates the data nicely.

In a subsequent form, we want to display the grid, so I added the same grid with pretty much the same fields, and set the grid control to "view".

With the help row variable, I am going to find all the controls placed under that row in edit mode using Find Control property.

After finding the controls I am using them to pass their values to the parameter of the Sql Command object that is ultimately updating the records into database.

You can notice that I have kept Required Field Validator too inside the Edit Item Template as I want the textbox to be validated for empty data.

In the same way you can put any kind of Validation controls inside Edit Item Template to validate the form element while user will click Update link.

Now you can ask questions directly to me on my new site ASPForums.

Net Question Answer site, specially started to allow visitors of this site ask their doubts and queries. Just click the Ask Now button and ask your question now.

I have specified Data Key Names as Auto ID, the primary key of the database table.

Tags: , ,