Rocky Rocky

Rocky Rocky

  • NA
  • 317
  • 152.2k

what was error in Mycode?

May 28 2013 7:35 AM
Hai Friends,
        In My application 've the  input fields of


INPUT FIELDS
==================
Name:textbox
class:dropdownlist

add(button)

after adding the details ll display on Gridview's.

i ve already done these much!
my requirement is when i choose edit in gridview's entire details ll shown on above input fields.



so i made the query like these



protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            string id = GridView1.Rows[i].Cells[1].Text;===>error
            string name = ((TextBox)GridView1.Rows[i].FindControl("txtname")).Text;
            string clas = ((DropDownList)GridView1.Rows[i].FindControl("DDL_Class")).ToString();
        

          

           

        }
        binddata();
    }


when i debug the code ll show error like this

"Object reference not set to an instance of an object." in GridView1_RowEditing  string id,string name,string clas


i dont know what was the problem in that?

Anybody can explain me and guideme.

 

Answers (1)