Hello, I have a problem in my composite control. In this composite control I create a GridView in one of the TableCells of a Table control. This GridView has multiple events on it, such as rowediting event, rowupdating event, rowcancelingedit event.
image: http://www.cezus.nl/GridView.JPG [code] private void BindData() { _gvCategories = (GridView)this.FindControl ("gvCategories"); _dtCategories = (DataTable)HttpContext.Current.Session ["dtCategories"]; _gvCategories.DataSource = _dtCategories; _gvCategories.AutoGenerateDeleteButton = true; _gvCategories.AutoGenerateEditButton = true; _gvCategories.RowEditing += new GridViewEditEventHandler (_gvCategories_RowEditing); _gvCategories.RowUpdating += new GridViewUpdateEventHandler (_gvCategories_RowUpdating); _gvCategories.RowDeleting += new GridViewDeleteEventHandler (_gvCategories_RowDeleting); _gvCategories.RowCreated += new GridViewRowEventHandler (_gvCategories_RowCreated); _gvCategories.RowCancelingEdit += new GridViewCancelEditEventHandler(_gvCategories_RowCancelingEdit); _gvCategories.DataBind(); } void _gvCategories_RowEditing(object sender, GridViewEditEventArgs e) { _gvCategories = (GridView)sender; _gvCategories.EditIndex = e.NewEditIndex; BindData(); } void _gvCategories_RowUpdating(object sender, GridViewUpdateEventArgs e) { _gvCategories = (GridView)sender; _dtCategories = (DataTable)HttpContext.Current.Session ["dtCategories"]; GridViewRow row = _gvCategories.Rows[e.RowIndex]; foreach (DataRow dr in _dtCategories.Rows) { if (dr.RowState != DataRowState.Deleted) { if (Convert.ToInt32(dr["drID"]) == Convert.ToInt32 (((TextBox)(row.Cells[3].Controls[0])).Text)) { dr["ID"] = ((TextBox)(row.Cells[1].Controls [0])).Text; dr["Categorie"] = ((TextBox)(row.Cells [2].Controls[0])).Text; } } } _gvCategories.EditIndex = -1; HttpContext.Current.Session["dtCategories"] = _dtCategories; BindData(); Button _btnNieuw = (Button)this.FindControl("btnNieuw"); _btnNieuw.Enabled = true; } [/code] If I press on the 'edit' button in the GridView it goes to the rowediting event. If I press after that on the 'update' button it goes again through the rowediting event instead of going through the rowupdating event. I am struggling for 2 days with this, I hope somebody knows a solution. With Kind Regards, Cees van Altena
