tags:

views:

72

answers:

4

I have some HTML that will need to be duplicated in a number of places. If I externalize this to a text file and include it in the ASPX page, it would work but I will need to pass a parameter to this HTML (ClientID)

Without having to create a User control, is there a lighter way of doing this?

+4  A: 

I would use a master page for this. Depending in the version of the framework(2.0+) Nested Master Pages are also an option.

cgreeno
A: 

You could just have a raw aspx file with the HTML inside:

<%

If (Request.QueryString["ClientID"]) {
    // Do Something
}

%>

<p>HTML File Contents</p>

Then you could either server-side include the file or server.execute the file.

GateKiller
A: 

You may want to clarify how you pass a ClientID to "HTML", because it sounds like you're doing server-side processing to generate your HTML, which is a classic case of Ajax. I would recommend using JQuery to achieve this.

John Rasch
A: 

Perhaps standard #Includes still work, but TBH I haven't found any downside to master pages (as yet). This is what they were designed for.

CJM