Menu control Databinding problem using StaticItemTemplate
Menu control Databinding problem using StaticItemTemplate
am 14.01.2008 18:43:47 von J055
Hi
How do add custom attributes to a System.Web.UI.WebControls.MenuItem in a
StaticItemTemplate which I have saved in my
SiteMapDataSource file? e.g.
protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)
{
string id = ((SiteMapNode)e.Item.DataItem)["id"];
if (id != null)
Trace.Write(id);
// add the attribute to the MenuItem
}
I can't see how you can do it with the Menu control. Do I have any other
options which are not too much work to implement?
Thanks
Andrew
RE: Menu control Databinding problem using StaticItemTemplate
am 15.01.2008 04:55:41 von stcheng
Hi Andrew,
As for adding custom attributes to ASP.NET 2.0 Menu control, it is limited
by the following things:
** the
Re: Menu control Databinding problem using StaticItemTemplate
am 15.01.2008 11:10:01 von J055
Hi Steven
When I pass a Container.DataItem it's always a MenuItem object. I cannot get
the underlying object from the SiteMapDataSource. Is this correct? I can't
get any additional information from the web.sitemap file. Any ideas?
ShowStartingNode="false" />
Thanks
Andrew
"Steven Cheng[MSFT]" wrote in message
news:yOLSIqyVIHA.4200@TK2MSFTNGHUB02.phx.gbl...
> Hi Andrew,
>
> As for adding custom attributes to ASP.NET 2.0 Menu control, it is
> limited
> by the following things:
>
> ** the
Re: Menu control Databinding problem using StaticItemTemplate
am 17.01.2008 09:33:28 von stcheng
Hi Andrew,
Yes, it's a pity that the MenuItem class is a sealed class that can not
extend(I previously handled some issue about TreeView control and its
TreeNode class can be derived).
Currently, based on my research, one means to provide additional data would
be using the "Value" property of the MenuItem, do you think it posible that
you bind all the information together (through some separator char) into
the single "Value" property. And in your template, you can use some helper
function to parse those mutiple properties out?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Andrew Jocelyn"
>References: <#cwhFUtVIHA.4140@TK2MSFTNGP04.phx.gbl>
>Subject: Re: Menu control Databinding problem using StaticItemTemplate
>Date: Tue, 15 Jan 2008 10:10:01 -0000
>
>Hi Steven
>
>When I pass a Container.DataItem it's always a MenuItem object. I cannot
get
>the underlying object from the SiteMapDataSource. Is this correct? I can't
>get any additional information from the web.sitemap file. Any ideas?
>
>
>
>ShowStartingNode="false" />
>
>Thanks
>Andrew
>
>
>
>"Steven Cheng[MSFT]" wrote in message
>news:yOLSIqyVIHA.4200@TK2MSFTNGHUB02.phx.gbl...
>> Hi Andrew,
>>
>> As for adding custom attributes to ASP.NET 2.0 Menu control, it is
>> limited
>> by the following things:
>>
>> ** the