Tengo un problema con el evento Row Updating de un Grid View de ASP. Cuando quiero saber el valor de una celda y por alguna razon, no me los trae.
Hi folks, Consider the following code: protected void grid View_Row Data Bound(object sender, Grid View Row Event Args e) This way, I've dynamically added a Drop Down List (DDL) control to the Grid View. However, I need to get the value selected in the DDL when the row is updating and add it to the e. "firstname.lastname@example.org" wrote: Hi folks, Consider the following code: protected void grid View_Row Data Bound(object sender, Grid View Row Event Args e) This way, I've dynamically added a Drop Down List (DDL) control to the Grid View. If the control is created in the Row Created event handler, everything works fine. When the page is loaded for the first time, the row that has got the panel will display the panel, very fast! therefore, the row's height is modified, and this is making me crazy.
When Edit link of the Grid View will be clicked then On Row Editing event will fire that will call Edit Record method.
In this method, I am specifying the Edit Index property of the Grid View to the New Edit Index of the Grid View and then calling Bind Data() method again to bind the data.
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.
Now I have declared a Grid View Row variable named row and stored the current row being edited into it.Till now our Grid View is ready to be populated, now let’s write a method to populate the Grid View.To populate the Grid View, I am calling Bind Data() method from Page_Load event after checking Is Post Back property of the page, so the Grid View will only be populated when there is no postback on the page (when the page loads for the first time).So I have to specify how I want them to appear in the normal view and edit view.
That’s why I have placed different templates like Item Template (for normal view) and Edit Item Template (for edit view).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.