开发者

how to find dynamically created table on button click

开发者 https://www.devze.com 2023-01-08 09:08 出处:网络
i created dynamically a table with in a function... this table is added to a panel. and this panel is in ajax updatepanel...

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, fo开发者_开发问答r 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


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#)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消