I have designing in my web page.
I have used the gridview, I have used the gridview delete
option. Get the following error,
Multiple controls with the same ID 'Ddl' were found. FindControl requires that controls have unique IDs.
My code is as follows,
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
Label Amount = (Label)(DisplayGrid.Rows[e.RowIndex].FindControl("lblAmount"));
Label Account = (Label)(DisplayGrid.Rows[e.RowIndex].FindControl("ddlAccount"));
DataTable dt = new DataTable();
开发者_开发问答 dt = CreateDataTable();
dt = (DataTable)Session["myDatatable"];
dt.DefaultView.AllowDelete = true;
dt.DefaultView.Delete(e.RowIndex);
dt.AcceptChanges();
Session["myDatatable"] = dt;
BindGrid();
}
Your GridView has 2 controls with id Ddl
, and hence you're getting the error,
Multiple controls with the same ID 'Ddl' were found. FindControl requires that controls have unique IDs.
Change the id
of the control in your GridView to (say) Ddl2
, you're error will be resolved.
精彩评论