Hey there...
I want to use c# to fill a string in my application that I can then use to place directly in my HTML code...
e.g.
REASON: I have about 10 pages all with the same menu system hardcoded in each page. I want to remove the menu html from all of these pages and then place a tag/string such as [#menucode#] into each of the 10 files where the menu code would normally have been... then I just have one file containing the menu code that my application uses to put into the string... that way I don't have to edit every page when I change 1 item in the menu etc...
Elias OlneyPosted Apr 8, 2008, 11:55 AM
Many thanks.
I placed a class in my application containg a public sting with all the menu HTML in it and then used the <%Response.Write(mystring.ToString();)%> Which works perfectly as I can fill my strings from SQL now etc...
Bechir BejaouiPosted Apr 8, 2008, 10:39 AM
You can do that either by using C# within an Asp page context or JavaScript within both Asp page context and Html page case
Use the javascript to do that:
if(document.getElementById)
document.getElementById('id').innerHTML = "I'm Bejaoui Bechir";
if(document.all)
document.all('id').innerHTML = "I'm Bejaoui Bechir";
if(document.layers)
document.layers('id').innerHTML = "Some words...";
' id' here the node id attribute in witch you want to insert text
You can use the C# too
Response.Write("Some words...");