Guys I am stuck with including Edit in my Grid View.. The Specifications of my problem are as follows:

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        try
        {
            GridView1.EditIndex = e.NewEditIndex;
            bindGvEdit();
        }
        catch (Exception ex)
        {
            lblUpdate.Text = ex.Message;
        }
    }

    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row = GridView1.Rows[e.RowIndex];
        objCust.CustId = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);
        objCust.CustAddress = txtCustAddress.Text;
        objCust.UpdateNewUser();
        GridView1.EditIndex = -1;
        bindGvEdit();
    }


    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Edit")
        {
            ViewState["CustId"] = e.CommandArgument;
            objCust.CustId = Convert.ToInt32(e.CommandArgument);
            DataSet dsSelectNewUser = objCust.SelectNewUser();
            txtCustAddress.Text = dsSelectNewUser.Tables[0].Rows[0].ItemArray[2].ToString(); 
        }
    }

I am actually inserting the value of CustAddress into txtCustAddress.TextBox and then using this textbox value into my Gridview.. But to my knowledge i found out that CustAddress is not getting any value on Debbuging.. Plz help to rectify the problem...

Guys got the solution for this :
No need for including Row command... Only rowUpdating is enough....

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row = GridView1.Rows[e.RowIndex];
        objCust.CustId = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);
        objCust.CustAddress = ((TextBox)row.Cells[2].Controls[0]).Text;
        objCust.UpdateNewUser();
        GridView1.EditIndex = -1;
        bindGvEdit();
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.