Click here to Skip to main content
16,016,580 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...
What I am trying to do is take in data from a database that a user can edit add multiple new rows of data and submit it back to the server.
So a simplified example is this... We have a simple database with a date, Travel Destination, Hotel Name and a tripid for the primary key. This is in a table called BusinessTrip.
What we would like to do is have a user able to either create a new trip or view and edit an existing trip. So if they view an exisiting trip it would bring up day 1 - Date, Travel Destination, Hotel Name then Day 2 - Date, Travel Destination, Hotel Name etc etc. down the page.
To accomplish this we have created a table on the aspx page and manually added rows consisting of cells containing textbox controls in the code behind by capturing the datasource selecting event and populating each text box. We also have a javascript function to dynamically add new rows to the table for extra days they may be travelling. This part works fine however if the user edits any of the text box data or adds new rows and then hits the submit any of the dynamically created data is lost. I have tried catching the datasources updating event and wanted to manually populate the datasource however by this stage I have already lost the data in the dynamically created text boxes. Is there any way of retaining this information from a dynamically created control? IS there any better way of perhaps going about this. We have seen the FormViews edit functions however it seems very annoying that the user has to firstly hit edit and the page refreshes after each row they change and if they add a row the page is updated.
Any help would be appreciated.
Thanks
Posted

1 solution

Hi Danny,

First u should no the asp.net page life cycle...
I have faced same issue in one of project where we are creating dynamic user controls having some child controls...here the logic is simple you have to capture the dynamic data befor the page load i.e in page_preinit and store it in same session.

Try this one


Regards
Vinay
 
Share this answer
 
v2

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