开发者

Change the content of fieldset html tag (or div, or whatever tag) dynamically.

I'm creating a "Settings" web-page for a project (using asp.net framework 3.5 under VS 2010).

There is 2 fieldsets on the page:

the first) as menu with buttons that are named "Configuration", "Data output formats", etc

the second) for showing set of web-controls for particular chosen menu item.

The question:

As you can guess I need to change dynamically the content of that second fieldset. By had searched in the internet I came to 2 choices:

1) create separate web-pages with web-controls for each of menu item and show them on the Settings web-page via use of iframe tag

2) write something like fieldset.innerHtml = "VERY long long long string line with html code" for every menu item choice. And it will be several such very long string lines caused several options available on th开发者_如何学运维e Settings page.

So what would you advise me to do, developers?

Maybe it exists the 3 way to do this that allows to avoid of using iframes and writing long awkward hard-to-maintain string lines of html code?


I'm not familiar with ASP, but, couldn't you just code the HTML for the controls of each menu item in a separate file and perform some kind of conditional server-side inclusion?

If not, you could always build your elements server-side in a single asp page.


There's a third way, you can make your page with all the fields that you need, having a fieldset for "Configuration", another for "Data Output Formats", etc...

Then you play with the visibility, when you click on the buttons it hides all the other fieldsets and shows only the desired one.

It's easier to maintain, and you don't have to do any extra requests to the server

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜