Hi all,
I have a problem with the clientIds that ASP.NET is omitting. Consider the
following code:
HtmlGenericControl listControl = new HtmlGenericControl("ul");
listControl.ID = menu.Name;
foreach (Node node in menu.Nodes)
{
if (node.ViewAllowed(this.CuyahogaUser))
{
HtmlGenericControl listItem = new HtmlGenericControl("li");
HyperLink hpl = new HyperLink();
hpl.NavigateUrl = UrlHelper.GetUrlFromNode(node);
UrlHelper.SetHyperLinkTarget(hpl, node);
hpl.Text = node.Title;
listItem.Controls.Add(hpl);
listControl.Controls.Add(listItem);
if (node.Id == this.ActiveNode.Id)
{
hpl.CssClass = "selected";
}
}
}
In the line listControl.ID = menu.Name;, the framework prefixes the menu.Name
with p_ and every hyperlink has the same problem if I give it an id.
The problem is that the positioning and imaging is tightly controlled by .css
files. I know I could change the .css but I would rather have control of the
ClientId I render. The ClientId property of the Control class is readonly.
Is there a way round this problem?
Thanks
Paul
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com