Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with dynamic html within the same Content pages

Status
Not open for further replies.

duftstenen

IS-IT--Management
Dec 4, 2008
14
0
0
DK
Hi everyone,

A question regard finding best practice when working with content pages in Master Page keeps annoying me.
Let’s say I have created a Master Page with the design and proper <asp:ContentPlaceHolder>s and a Content page which contains <asp:Content> etc. The MasterPage contains a ContentPlaceholder which display all the text; it’s called “Main”. When the page (Default.aspx) loads for the first time a welcome message is displayed, defined in <asp:Content> for “Main”. When a button is clicked on Default.aspx and the Button_Click method is fired, it should remove the text and make some other html layout, run some method and display the result. I have looked into the possibility to have different <asp:content> which I can choose with some Visible true/false after the button click, but this doesn’t seems the right way to do. Neither is it to clear all current content and build it up with let’s say .InnerHtml etc.? What is the best practice in this matter?

Best regards
Duftstenen
 
I'd say the easiest way is to define to panels, each containing the appropriate html / controls.

Then, when the page is loaded check the view state for a value. if not present, make the welcome message visible and store a value back into the view state, so you only one-shot the welcome message once per time the page is navigated to.

Personally I think all the viewstate / bool flag should be in a single property and bind the visibility of both panels to it, but I dont think that there is a "Best way" for this kind of thing, sorry.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top