I am trying to do RadMenu by reading all content from XML file. And adding some item elements to the menu on C# code like the one on the video tutorial. the C# code is the following:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Xml;
using Telerik.Web.UI;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)
{
XmlElement element = e.Item.DataItem as XmlElement;
if (element.Attributes["ParentID"].Value == "Carriers")
{
e.Item.Width = Unit.Pixel(228);
Telerik.Web.UI.RadMenuItem mItem = e.Item.Parent as RadMenuItem;
XmlElement elements = e.Item.DataItem as XmlElement;
Panel CarriersLink = CreateCarriersNavigation(elements.Attributes["LogoLocation"].Value,
elements.Attributes["NavigateUrl"].Value);
e.Item.Controls.Add(CarriersLink);
}
}
private Panel CreateCarriersNavigation(string LogoLocationSrc, string NavigateUrlSrc)
{
Panel CarriersNavigationPanel = new Panel();
Image CarriersLogo = new Image();
CarriersLogo.ImageUrl = LogoLocationSrc;
HyperLink CarriersLogoLink = new HyperLink();
CarriersLogoLink.ImageUrl = LogoLocationSrc;
CarriersLogoLink.NavigateUrl = NavigateUrlSrc;
CarriersNavigationPanel.Controls.Add(CarriersLogoLink);
return CarriersNavigationPanel;
}
}
Please refer to picture below:
http://img524.imageshack.us/img524/3631/26999155.png
My questions would be:
1) How can I add the item (element) by 4 rows and 4 columns (total 16 items). As you can see from the picture, the item is added below, so there is only 1 column and lots of row items. I want to do 4 rows items, then start new column by adding others items. So if I have 16 items, then it would be 4 rows and 4 columns
2) Those logo are the link to external link. It does work. However when click on it, it will replace the current page. How do I make it to open in the new tab or new window. For example, <a href=http://www.newsite.com target='_blank'>new site</a> will open that page in the new page. But I cannot do that since the code need to be in C# (the copy of code is above).
Thanks in advance
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Xml;
using Telerik.Web.UI;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)
{
XmlElement element = e.Item.DataItem as XmlElement;
if (element.Attributes["ParentID"].Value == "Carriers")
{
e.Item.Width = Unit.Pixel(228);
Telerik.Web.UI.RadMenuItem mItem = e.Item.Parent as RadMenuItem;
XmlElement elements = e.Item.DataItem as XmlElement;
Panel CarriersLink = CreateCarriersNavigation(elements.Attributes["LogoLocation"].Value,
elements.Attributes["NavigateUrl"].Value);
e.Item.Controls.Add(CarriersLink);
}
}
private Panel CreateCarriersNavigation(string LogoLocationSrc, string NavigateUrlSrc)
{
Panel CarriersNavigationPanel = new Panel();
Image CarriersLogo = new Image();
CarriersLogo.ImageUrl = LogoLocationSrc;
HyperLink CarriersLogoLink = new HyperLink();
CarriersLogoLink.ImageUrl = LogoLocationSrc;
CarriersLogoLink.NavigateUrl = NavigateUrlSrc;
CarriersNavigationPanel.Controls.Add(CarriersLogoLink);
return CarriersNavigationPanel;
}
}
Please refer to picture below:
http://img524.imageshack.us/img524/3631/26999155.png
My questions would be:
1) How can I add the item (element) by 4 rows and 4 columns (total 16 items). As you can see from the picture, the item is added below, so there is only 1 column and lots of row items. I want to do 4 rows items, then start new column by adding others items. So if I have 16 items, then it would be 4 rows and 4 columns
2) Those logo are the link to external link. It does work. However when click on it, it will replace the current page. How do I make it to open in the new tab or new window. For example, <a href=http://www.newsite.com target='_blank'>new site</a> will open that page in the new page. But I cannot do that since the code need to be in C# (the copy of code is above).
Thanks in advance