This is a migrated thread and some comments may be shown as answers.

Open link in a new window

5 Answers 167 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Samantha
Top achievements
Rank 1
Samantha asked on 22 Sep 2008, 09:25 PM
I have a tab strip bound to a sitemap data source control.  I need some of the links to open in their own window.  How can I do this?

5 Answers, 1 is accepted

Sort by
0
Serrin
Top achievements
Rank 1
answered on 24 Sep 2008, 01:09 PM
Hey Samantha,

I know TabStrip has a target property for each item that you can set to _blank (aka, new window)...  is that something that you can do in design-time or are you doing everything dynamically?
0
Samantha
Top achievements
Rank 1
answered on 24 Sep 2008, 01:12 PM
I need to do it dynamically.  I created an extra attribute in the sitemap, target="_blank" and was trying to check the value (I did this once before with a .Net menu control) and then set the tab property, but I couldn't figure out how to apply it to the tabs.
0
Paul
Telerik team
answered on 24 Sep 2008, 01:15 PM
Hi Samantha,

For details on how to set additional properties or overwrite already populated fields please refer to this help article.

All the best,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Samantha
Top achievements
Rank 1
answered on 24 Sep 2008, 02:12 PM
this is helpful, but it's not working.  I get the following error:

DataBinding: 'System.Web.SiteMapNode' does not contain a property with the name 'target'.

When I tried:

e.Tab.Target = (

string)DataBinder.Eval(e.Tab.DataItem, "target");

I also tried:

XmlElement element = (XmlElement)e.Tab.DataItem;

e.Tab.Target = element.Attributes["target"].Value;

and I got:

Unable to cast object of type 'System.Web.SiteMapNode' to type 'System.Xml.XmlElement'.

A typical sitemap node in my sitemap looks like:

<

siteMapNode url="" title="" target=""></siteMapNode>

0
Paul
Telerik team
answered on 24 Sep 2008, 02:35 PM
Hi Samantha,

Please find below a sample code snippet that shows the needed approach.

protected void RadTabStrip1_TabDataBound(object sender, RadTabStripEventArgs e)  
{  
    SiteMapNode siteMapNode = (SiteMapNode)e.Tab.DataItem;  
    string CustomProperty = siteMapNode["target"];  
    e.Tab.Target = CustomProperty;  


Greetings,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TabStrip
Asked by
Samantha
Top achievements
Rank 1
Answers by
Serrin
Top achievements
Rank 1
Samantha
Top achievements
Rank 1
Paul
Telerik team
Share this question
or