Click here to Skip to main content
15,894,046 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

The idea is that a pure html table will be generated on the client side. (using javascript add dynamic new rows to the table when the user clicks a button). These rows contain textboxes, dropdownlists and other input controls.
When the user clicks a button, a PostBack is triggered in which I need to access this data from the table on server side, validate it and perform other actions on it.
I'm able to perform the client side and access the table data on server side by adding runat="server" to the table tag. However, I only see the initial table rows (not the ones added through JavaScript) and I have troubles retrieving the different inputs from the rows.
Can anyone help me out here or put me in the right direction?? Or someone offering a better solution to the problem?

I am using Javascript,Ajax Page Methods and callback methods to implement this..

Thanks
Posted

Hi,

Use hidden variable to save the table generated dynamically by javascript.
Before going to server side, populate the hidden field (Server side control) and access it in back page code.

Regards,
Jitendra Zaa
 
Share this answer
 
asdf,

Why don't you put the table in the UpdatePanel and add the rows on server side itself.

If you want in javascript only, and also you said table is set to intial rows only, make sure that you don't intialize or bind data to table on postback in page load. First time page load should populate data to table but not on postback to pertain the client side data.
 
Share this answer
 

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