Dynamically Change User Control in ASP.Net

后端 未结 4 1379
Happy的楠姐
Happy的楠姐 2020-11-30 05:55

I\'m trying to create a web page that will display an appropriate user control based on the selected value of a drop down list.

Basically the page layout is this:

4条回答
  •  天涯浪人
    2020-11-30 07:00

    If the list of options is not too big, you could just render all the user controls statically and use JavaScript/jQuery to show/hide the appropriate controls based on the value of the dropdown (onchange js event). You can use the dropdown value to extract the appropriate values from the user controls when saving.

    You avoid the pain of dealing with dynamic controls, provide a more responsive UI when selecting from the dropdown (no postback), etc...

提交回复
热议问题