skip to content »

Row updating event in grid view

row updating event in grid view-64

This enables you to provide an event-handling method that performs a custom routine, such as canceling the update operation, whenever this event occurs.A Grid View Update Event Args object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the update operation should be canceled.

row updating event in grid view-19row updating event in grid view-67

Unfortunately, I can not create it in design mode because the tables and their fields are defined in DB, so in design time I do not know which table and fields will be displayed by the Grid View. I created a sample Class: private Panel doc Panel = new Panel(); private Grid View detail GV = new Grid View(); private Sql Data Source sql Detail DS = new Sql Data Source(); public Label mess Lbl = new Label(); private string connection String = "Data Source=xxxx; Initial Catalog=intranet; Integrated Security=True"; private List My problem is that the Grid View is generated sucessfully but I can not update the modified fields. private Grid View load Dynamic Grid(Grid View Grd Dynamic, Sql Data Source sql DS) { Grd Dynamic. Data Key Names = new string[] ; ..................................................... Yes, this is a similar problem but unfortunatelly, there were no working solution. Follow this link for more details --While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference.event is raised when a row's Update button is clicked, but before the Grid View control updates the row.In fact, the first thing I tried was this protected void Page_Load(object sender, Event Args e) public void DT() protected void GView_Row Updating(object sender, Grid View Update Event Args e) protected void GView_Row Canceling Edit(object sender, Grid View Cancel Edit Event Args e) private void Bind Data() if I execute the method DT when Is Post Back then when the gridview enters in Edit Mode and I tried to Update the cells, the Row Updating never fires and after the post back the gridview keeps on edit mode without my changes, but I need to execute this method when is Post Back, in other way the gridview control fade away. When I Filter the data using dropdown selected Index Changed event the gridview shall load data based on what is searched.Eighter the Old Values or New Values dictionaries are empty. In this case when I tried to get data before databind asp drops "Argument Out Of Range Exception". Regards, Tibor Hi, Yes, I checked New Values, it is empty.

I think the first must be the command field, 2nd and 3rd are "ID" and "elso_detailed_mezo".

If so, I suspect you do a Data Bind before the Update happens. Please remember to click “Mark as Answer” on the post that helps you.

I have a web application that shows a controls group based on a result set from a database.

" Thanks and regards, Tibor Good Morning Arif, I tried your code. I count the number of column in variable: "j", it counts only 1 instead of 3.

When I try to use wrong parameter name, asp drops this message "Must declare the scalar variable "@elso_detailed_mezo".

Thanks to all you for answer, but the examples posted aren't my case.