2

i created dynamically a table with in a function... this table is added to a panel. and this panel is in ajax updatepanel... statically i have given no of rows as 3, for that table... in page_load my table with 3 rows is created.... but i cannot identify this table in another button click event...

i wrote the code like this...

System.Web.UI.WebControls.Table table = (System.Web.UI.WebControls.Table)addrowpnl.FindControl("Table1");

here Table1 is my dynamic table id.....

could anyone please suggest me to solve this

Oded
  • 489,969
  • 99
  • 883
  • 1,009
Ramakrishna
  • 83
  • 2
  • 9

2 Answers2

0

This is the so known problem of dynamically created objects in ASP.NET.

Read this to get a grasp of what I'm telling you:

Accessing controls created dynamically (c#)

Community
  • 1
  • 1
Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
0

I had similar problem with dynamically created buttons. What you should try is to create objects in Page_Init rather then in Page_Load. I know it is not always possible but it should be done there.

Maciej
  • 7,871
  • 1
  • 31
  • 36