Click here to Skip to main content
15,881,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
i have created few dynamic grid view inside a panel

Method where i added control

C#
pRelaese.Controls.Add(DynamicGrid(dt));


i'm saving the grid view id in a hidden variable

i added a button inside a update panel

C#
string[] GridName = hdnGridName.Value.Split(',');
      foreach (string GN in GridName)
      {
          GV = this.FindControl("pRelaese").FindControl(GN) as GridView;//tried this
          pnl = (Panel)Page.FindControl("pRelaese");//tried this
          GV = (GridView)pnl.FindControl(GN);//tried this
          if (GV != null)
          {
              foreach (GridViewRow GVR in GV.Rows)
              {
                  //codes
              }
          }
      }

But every time the
SQL
null 
is returned to GV

i need to find control and insert it into GV to perform of the task
Posted
Updated 1-Nov-15 19:47pm
v2
Comments
Sinisa Hajnal 2-Nov-15 6:25am    
When you load the page, press F12 to bring up developer tools and check grid IDs in page source. Depending on how you create them and what IDs you're using in hidden control you might get null because they don't match. (server controls get their names mangled in asp.net)
write2varun 2-Nov-15 6:43am    
the hidden control has the same id as the id getting rendered

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