J
JPH
Hi all
I have made a menu using an ascx control and have embedded it into a
page. It uses a Repeater to display a list of hyperlinks:
<itemtemplate>
<li>
<a href='news.aspx?newsID=<%#
DataBinder.Eval(Container.DataItem,"newsID") %>'>
<%# DataBinder.Eval(Container.DataItem, "newsHeadline") %>
</a>
</li>
</itemtemplate>
What I would like to do is reuse this menu control in any page that
needs a dynamic menu. I can find out what the parent form is by using:
this.Parent.ToString(); so its easy to switch stored procedures in my
code behind page to get the valid menu links. However, I'm not sure how
to dynamically switch the
code in the html side of things. For instance, if it was a projects
page that had the menu embedded into it, the url should read something
like this:
<a href='project.aspx?projectID=<%#
DataBinder.Eval(Container.DataItem,"projectID") %>'>
<%# DataBinder.Eval(Container.DataItem, "projectTitle") %>
</a>
I have tried using a literal and writing the html to it on the fly but
it got nasty.
Any help is much appreciated
Thanks
John
I have made a menu using an ascx control and have embedded it into a
page. It uses a Repeater to display a list of hyperlinks:
<itemtemplate>
<li>
<a href='news.aspx?newsID=<%#
DataBinder.Eval(Container.DataItem,"newsID") %>'>
<%# DataBinder.Eval(Container.DataItem, "newsHeadline") %>
</a>
</li>
</itemtemplate>
What I would like to do is reuse this menu control in any page that
needs a dynamic menu. I can find out what the parent form is by using:
this.Parent.ToString(); so its easy to switch stored procedures in my
code behind page to get the valid menu links. However, I'm not sure how
to dynamically switch the
code in the html side of things. For instance, if it was a projects
page that had the menu embedded into it, the url should read something
like this:
<a href='project.aspx?projectID=<%#
DataBinder.Eval(Container.DataItem,"projectID") %>'>
<%# DataBinder.Eval(Container.DataItem, "projectTitle") %>
</a>
I have tried using a literal and writing the html to it on the fly but
it got nasty.
Any help is much appreciated
Thanks
John