How to dynamically add table rows within update panel ?

Hi,

In my webform, i have 3-4 textbox, on there textchange event i have to fetch data from database and put it on the form. I have taken another html table (with runat=”server”)  below textbox and  and in textchange event created a new

,

and simply added contents in

, then finally added

in the table. This is done in UpdatePanel.

When i enter something in textbox1 data is added in that table,that’s fine.

But when i enter something in 2nd textbox the previous data is overridden.

My requirement is that if 2nd textbox’s text changes than another row with appropiate data should be added, i.e., now two rows.

Silimarly if 3rd ,4th textbox data changes then subsequently 3 or 4 rows should be displayed.

What should i do ?

Hi Every thing you Create in Runtime will be lost if it Not saved in anywhere .this Process called State Management. So you need to save you Rows in Some Where , for example i use Session Here Like This DataTable dt = new DataTable();

I think dynamic controls will have to recreated on page Initialization as they will lose the content even though you use an update  panel.If you keep the controls in an udpate panel, controls may not updated in the page. I mean that the controls will be visible in the pagebut you will not be able to access themexample will be an html  table.If you keep the HTML table  in an update panel  with update mode as conditional and add  some controls on postback.http://forums.asp.net/p/1095985/1662848.aspxhttp://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_23017058.html

Hi,You could add  control in updatepanel  like below: LinkButton lbtn = new LinkButton();