Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
what i particularly want is to find details view inside gridview which is placed outside the gridview is it possible ? I want that to happen on GridView RowCommand. Everytime i try to find it the control remains null.

This is what i am doing :

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
   {


       if (e.CommandName.Equals("edit"))
       {



           int id = Convert.ToInt32(e.CommandArgument);

           string r = GridView1.DataKeys[id - 1].Value.ToString();


           GridViewRow row = GridView1.Rows[id];

            DetailsView  dv = (DetailsView)ridView1.Rows[id].FindControl("DetailsView1");  // getting it as null



           dv.DataSource = ds.Tables[0];      // Object refrence not set to instance of object: Error
           dv.DataBind();
           dv.Visible = true;



       }


Thank you.
Posted
Updated 4-Mar-14 2:25am
v2
Comments
ZurdoDev 4-Mar-14 9:31am    
You said it was outside of the gridview but you are using FindControl on the row of the gridview. Perhaps choose the Page.FindControl instead or whatever parent the details view has.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900