Click here to Skip to main content
15,908,675 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai,

I am doing one website in asp.net using c#, in that am dynamically adding radion button, buttons into pane with events also. But when page is reloading am not getting old control. Suppose i created two radio button Yes and No. When i click Yes button, page is reloading and am getting new button. I want to save old values in database, What to do for that? Please help me


Thanks
Sujith.
Posted
Comments
Varun Sareen 16-Feb-12 5:23am    
Dear Friend,

You are mixing two things, you want to save old values where?? in db or in front end only?

If you are trying to maintain the radio button values in the front end only then you can use the functionality of hidden field .

As on the postback of your page the value of radio button may be lost but the values in hidden field will continue to persist and then you can set the previous value of radio button fetched from database.

And the database value doesn't changes if you haven't performed a database operation on the radio button value changed.

http://www.devmanuals.com/tutorials/ms/aspdotnet/hiddenfield.html[^]

http://dotnet.dzone.com/news/aspnet-client-side-state-manag-0[^]

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hiddenfield.value.aspx[^]

I hope this clears your problem. :)
 
Share this answer
 
v2
Make sure you create any dynamic controls onLoad or before, otherwise the famework doesn't have anything to load the values into. If you do this, they will be populated on postback. You don't need to display these controls in subsequent responses, buy they do need to be there in time for the framework to access them.
See http://msdn.microsoft.com/en-us/library/ms178472.aspx#general_page_lifecycle_stages[^] for the page lifecycle: understanding this and its consequences is useful to ASP.NET development.
 
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