开发者

How clear error gridview

开发者 https://www.devze.com 2023-03-15 06:22 出处:网络
I have designing in my web page. I have used the gridview, I have used the gridview delete option. Get the following error,

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消