daniel liu
Top achievements
Rank 1
daniel liu
asked on 16 Dec 2009, 11:18 PM
Hi,
Would you please provide sample code to enable hyperlink for telerik:RadMenu + XmlDataSource ?
Thanks
daniel
Would you please provide sample code to enable hyperlink for telerik:RadMenu + XmlDataSource ?
Thanks
daniel
10 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 17 Dec 2009, 09:41 AM
Hi Daniel,
When binding to an XmlDataSource, RadMenu creates the menu item hierarchy automatically. Checkout the following documentation that shows how to bind RadMenu with XmlDataSource.
Binding to Hierarchical DataSource Components
-Shinu.
When binding to an XmlDataSource, RadMenu creates the menu item hierarchy automatically. Checkout the following documentation that shows how to bind RadMenu with XmlDataSource.
Binding to Hierarchical DataSource Components
-Shinu.
0
daniel liu
Top achievements
Rank 1
answered on 17 Dec 2009, 08:43 PM
Thanks, it works fine.
Is it anyway to manage the authorization from xml or c# code? like some menu items will auto-hide if some login users do not in a Admin role?
thanks
daniel
Is it anyway to manage the authorization from xml or c# code? like some menu items will auto-hide if some login users do not in a Admin role?
thanks
daniel
0
daniel liu
Top achievements
Rank 1
answered on 23 Dec 2009, 12:01 AM
Hi,
Is it anyway to manage the menu authorization from xml or c# code?
like some menu items will auto-hide if some login users do not in a Admin role?
thanks
daniel
0
Shinu
Top achievements
Rank 2
answered on 23 Dec 2009, 09:31 AM
Hello Daniel,
You can set visibility of RadMenuItems in ItemDataBound event after checking the user logged in mode.
CS:
-Shinu.
You can set visibility of RadMenuItems in ItemDataBound event after checking the user logged in mode.
CS:
protected void RadMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e) |
{ |
if (userMode)// Check for the user mode |
{ |
if (e.Item.Text == "ANATR") |
{ |
e.Item.Visible = false; |
} |
} |
} |
-Shinu.
0
daniel liu
Top achievements
Rank 1
answered on 23 Dec 2009, 05:56 PM
Thanks for reply.
Could you show how to manage the menuitem visibility by using AccessKey in C# code?
<Item Text="Administrator Menu" AccessKey="Admin" >
Thanks a lot.
daniel
Could you show how to manage the menuitem visibility by using AccessKey in C# code?
<Item Text="Administrator Menu" AccessKey="Admin" >
Thanks a lot.
daniel
0
Hello daniel,
You can still use Shinu's suggestion and check the items' AccessKey value in ItemDataBound:
Kind regards,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You can still use Shinu's suggestion and check the items' AccessKey value in ItemDataBound:
protected
void
RadMenu1_ItemDataBound(
object
sender, Telerik.Web.UI.RadMenuEventArgs e)
{
if
(userMode)
// Check for the user mode
{
if
(e.Item.AccessKey==
"Admin"
)
{
e.Item.Visible =
true
;
}
}
}
Kind regards,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
daniel liu
Top achievements
Rank 1
answered on 04 Jan 2010, 06:10 PM
I tried it in RadMenu1_ItemDataBound event, but
e.Item.AccessKey always return empty string, and e.Item.Text returns correct value.
Did I miss anything?
Thanks
daniel
e.Item.AccessKey always return empty string, and e.Item.Text returns correct value.
Did I miss anything?
Thanks
daniel
0
daniel liu
Top achievements
Rank 1
answered on 05 Jan 2010, 11:38 PM
Hi,
did not get your reply yet.
Would you help to find out why e.Item.AccessKey always return empty string in RadMenu1_ItemDataBound event?
Thanks
daniel
Thanks
daniel
0
Accepted
Hi daniel liu,
Actually, e.Item.AccessKey corresponds to the AccessKey property of the RadMenuItem class which is used to assign an access key to the menu item.
In your case you need to do the following:
Hope this helps.
All the best,
Veskoni
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Actually, e.Item.AccessKey corresponds to the AccessKey property of the RadMenuItem class which is used to assign an access key to the menu item.
In your case you need to do the following:
void
RadMenu1_ItemDataBound(
object
sender, Telerik.Web.UI.RadMenuEventArgs e)
{
XmlElement sourceData = (e.Item.DataItem
as
System.Xml.XmlElement);
if
(sourceData.Attributes[
"AccessKey"
] !=
null
&& sourceData.Attributes[
"AccessKey"
].Value ==
"admin"
)
{
//admin AccessKey
}
}
Hope this helps.
All the best,
Veskoni
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
daniel liu
Top achievements
Rank 1
answered on 12 Jan 2010, 06:27 PM
thanks, it works.