Hi,
I was hoping someone could help me. I am using an AdRotator control with an xml file for the banners. The problem I have is that some of the banners, when clicked on, I want to display in a new window (ie.. Target=_blank) and some I want to display in the same window (ie..Target=_parent). Is there a way I can add the target setting in the XML file for each banner so when the banner loads the correct target property is used for each banner?
Thanks in Advance!
Jay
Loading
JayPosted Jul 30, 2010, 11:20 AM
I figured it out so if anyone has the same issue, here's the solution.
You can add a custom element to the XML file. I added a
protected void banner_AdCreated( object sender, AdCreatedEventArgs e)
{
banner.Target = e.AdProperties["TargetUrl"].ToString();
}
And that's it!
JayPosted Jul 30, 2010, 10:09 AM
Thanks for the response but this will not work. I am using an Ad Rotator control where it can display more than 1 banner. The Ad Rotator will be displaying 4 different ads and 2 I need a target of _blank and the other 2 I need a target of _parent. There is no way to differentiate which ad is displaying through the Ad Rotator. So I was hoping I could use the XML advertisement file to differentiate between the ads. For example I was hopeing in the XML file I could put a tag like
Jay
ali razaPosted Jul 30, 2010, 5:25 AM
Turn your link in a server control if it is not! using runat="server", and set its target property from code behind.
for example:
write following code in .aspx page.
<a id="ahref" href="http://www.w3schools.com" runat="server">Visit W3Schoolsa>
and write following code in code behind page load's method.
ahref.Target = "_self";
Hope it helps you.