Hi
I've succesfully got a databound radmenu working but it our application I need to be able to open aspx pages in named windows i.e. we end up with multiple open windows.
Is this possible? There is no target property available in the radmenu and while this is available in the radmenuitem I cant seem to get this to work for a databound menu.
Thanks
Richard
I've succesfully got a databound radmenu working but it our application I need to be able to open aspx pages in named windows i.e. we end up with multiple open windows.
Is this possible? There is no target property available in the radmenu and while this is available in the radmenuitem I cant seem to get this to work for a databound menu.
Thanks
Richard
3 Answers, 1 is accepted
0
Hello Richard,
You can use a databinding to specify the Target for all menu items:
If the the name of the window is stored in the database (say in a "WindowName" database column) you can use the following databinding:
Regards,
Albert
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You can use a databinding to specify the Target for all menu items:
<telerik:RadMenu runat="server" ID="RadMenu1"> |
<DataBindings> |
<telerik:RadMenuItemBinding Target="myTarget" /> |
</DataBindings> |
</telerik:RadMenu> |
If the the name of the window is stored in the database (say in a "WindowName" database column) you can use the following databinding:
<telerik:RadMenu runat="server" ID="RadMenu1"> |
<DataBindings> |
<telerik:RadMenuItemBinding TargetField="WindowName" /> |
</DataBindings> |
</telerik:RadMenu> |
Regards,
Albert
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Simon Allport
Top achievements
Rank 2
answered on 21 Sep 2009, 08:22 AM
Hi,
I take it the example does it for all items in the menu , but what if you only want some of the child items to open up in a new window?
Would 'WindowName' for each item be like "_blank" , "_Self" etc... would that then work for above?
Thanks
Simon
I take it the example does it for all items in the menu , but what if you only want some of the child items to open up in a new window?
<telerik:RadMenu runat="server" ID="RadMenu1"> |
<DataBindings> |
<telerik:RadMenuItemBinding TargetField="WindowName" /> |
</DataBindings> |
</telerik:RadMenu> |
Would 'WindowName' for each item be like "_blank" , "_Self" etc... would that then work for above?
Thanks
Simon
0
Hello Simon,
Yes, all items are affected, but the value can be different depending on what comes from the data source. Here is a simple demo to try that uses a fake data table:
Greetings,
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.
Yes, all items are affected, but the value can be different depending on what comes from the data source. Here is a simple demo to try that uses a fake data table:
<telerik:RadMenu ID="RadMenu1" runat="server"> |
<DataBindings> |
<telerik:RadMenuItemBinding TargetField="Target" /> |
</DataBindings> |
</telerik:RadMenu> |
private DataTable CreateTestTable() |
{ |
DataTable table = new DataTable(); |
table.Columns.Add("ID"); |
table.Columns.Add("ParentID"); |
table.Columns.Add("Text"); |
table.Columns.Add("URL"); |
table.Columns.Add("Target"); |
table.Rows.Add(new string[] { "1", null, "root 1(opens in new window)", "root1.aspx", "_blank" }); |
table.Rows.Add(new string[] { "2", null, "root 2(opens in same window)", "root2.aspx", "_self" }); |
table.Rows.Add(new string[] { "3", "1", "child 1.1(opens in new window) ", "child11.aspx", "_blank" }); |
table.Rows.Add(new string[] { "4", "1", "child 1.2(opens in same window)", "child12.aspx", "_self" }); |
return table; |
} |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!IsPostBack) |
{ |
RadMenu1.DataSource = CreateTestTable(); |
//Establish hierarchy: |
RadMenu1.DataFieldID = "ID"; |
RadMenu1.DataFieldParentID = "ParentID"; |
//Set Text, Value, and NavigateUrl: |
RadMenu1.DataTextField = "Text"; |
RadMenu1.DataValueField = "ID"; |
RadMenu1.DataNavigateUrlField = "URL"; |
RadMenu1.DataBind(); |
} |
} |
Greetings,
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.