Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 777.7k

How is GridView Data Update function in ASP.NET

Dec 27 2013 5:27 AM
Sir, I need your help in the following topic:

How to update GridView data by passing them into textBoxes outside gridview in asp.net?.

My intention is when I lick edit button in gridview, which is linkbutton,  I need the concerned data to passes into the Class Name and NoOfSeats TextBox outside GridView. How can it done?

Here is my application:-



Here my GridView_RowUpdating Event:-

protected void gvClass_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                classSP spClass = new classSP();
                classInfo infoClass = new classInfo();
                GridViewRow gvRow = gvClass.Rows[e.RowIndex];
                infoClass.classId = decimal.Parse(gvClass.DataKeys[e.RowIndex].Value.ToString());
                infoClass.className = ((TextBox)gvRow.FindControl("txtClassName")).Text;
                infoClass.noOfSeats = int.Parse(((TextBox)gvRow.FindControl("txtNoOfSeats")).Text);
                int inCount = spClass.ClassEdit(infoClass);
                gvClass.EditIndex = -1;
                GridFill();
            }
            catch (Exception)
            {
               
                throw;
            }
        }

Answers (1)