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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating DHTML Menus 1

Status
Not open for further replies.

Kalisto

Programmer
Feb 18, 2003
997
GB
Ive googled for this and all I can find are a handful of links to free download sites that dont contain the code!
Can someone help me figure out how to render dhtml menu's using c#.
I assume I need to use a writer to add the appropriate code to the page's controls collection, but I cant get this working, so maybe Im wrong?

Cheers
K
 
If you want to render HTML from the server, you could use a Literal control and set it's Text property. Is there a particular reason why you can't simply place the DHTML menu in the HTML?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Probably my misunderstanding, I dont do much front end development!

I want to add some dhtml menu's to my aspx page. So the best thing to do is to add a literal control and write the code to it?

What if I want to add javascript to the html, is that to a literal control as well?

K
 
I want to add some dhtml menu's to my aspx page. So the best thing to do is to add a literal control and write the code to it?
Yes, that's a fairly easy way of rendering HTML to a page.

What if I want to add javascript to the html, is that to a literal control as well?
You should use the Page.RegisterStartupScript() and Page.RegisterClientScriptBlock() methods for adding Javascript to your page.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Ok, some success.

am I being too complicated here.

At the moment my process is;
create a stream pointing to the file that conatins the literal I am writing to.
create a htmlwriter from the stream
Render all the html
call the literal.RenderControl(htmlwriter) method ?

If I do this I get an error message to do with security and IIS.

I have seen an example where the literal control has the html added to it as a set of strings, but I have this vague recollection in my mind that I ought to use the HTMLTextWriter not hand build the strings.

Any thoughts?

K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top