Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# baldec 10/1/2008 11:52 AM
Hello again, this time the question of the day is if it is possible to have C# code integrate with templates? Possible and a reasonable idea or just plain stupid?

The thing is that I have a page with three "subsections" that aint on the normal menubar and by chosing one of the three subections I want to highlight the chosen section whilst showing the menubar (and selected menu item) in a normal fashion.

Thus the possibly odd question.
# martijnb 10/1/2008 8:57 PM
Maybe you can do this client-side with some javascript to show/hide the subsections. You can then put that in a template ascx without much trouble.
# baldec 10/2/2008 9:46 AM
Not possible to add executing code in the templates then, doh. Would have been a much niftier solution and style the content accordingly. Ahh well, guess one have to accept and go client side, though had hoped to avoid it.
# martijnb 10/3/2008 1:29 PM
Well, you can always add code to a template with a script block if you want (brackets omitted):
script language="C#" runat="server"
    protected Page_Load(object sender, EventArgs e)
    {
        ..your code goes here
    }
/script

# baldec 10/6/2008 1:54 PM
Thank you, will see if I can manage to do what I intend with that now. .js did solve the issue but would be much nicer if all rendering is done on the server (especially since it is "slightly" more powerful).