Dynamically create controls and save control values ​​through postback - ASP.Net C #

Consider this -

I allow the end user to create dynamic tab management on an ASP.Net page, getting some details. For each tab I add, I get some settings -

  • Header title
  • Tab contents
  • footer tab

So, I get this data for each tab. The user is provided with a button "Add Tab" to another tab. Therefore, I need to add another tab settings panel on the page in order to get the tab settings. But at the same time, I lose the values ​​entered on the previously created dynamic tab settings panel. The user can add as many tabs and enter settings for each tab. Finally, when they save it, I create a tab control (based on their settings and contents), and I visualize the control.

Since the controls are dynamic, I can use two options -

  • Create the n - 1 tab settings panel you created earlier when adding the nth tab. Therefore, for each postback I need to recreate the settings panel for each tab. But I do not know how to save the values ​​in this case.
  • Add the settings panel on the client side using simple html controls and on the UnLoad page analyze the controls → Parse the parameters → Save this in a hidden field → Get it on the server side. In this case, I lose all the server-side capabilities where I need to write validation scripts for the controls.

Any ideas on how best to do this?

+5
source share
3 answers

, ,

, viewstate, CreateChildControls

+2

- , ViewState. PreRender, . Postback , , . LoadViewState.

Page_Load

+1

№1 . , . , , , , . - , .

0

All Articles