In the previous I had explained ‘AdRotator Example in
Asp.Net using Xml file’. In this post I am explaining
‘AdRotator using Ajax in Asp.Net’.
Just Do the same thing as previously AdRotator Example.
Follow the Code which is written below.
Design.aspx:-
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Timer ID="Timer1" runat="server" Interval="2000" ontick="Timer1_Tick"></asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/AdRotatorXMLFile.xml" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger EventName="Tick" ControlID="Timer1" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
Design.aspx.cs:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default :
System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
}
protected void
Timer1_Tick(object sender, EventArgs e)
{
}
}
In this
example Timer is used because it displays the Advertisement at short interval
of time automatically.
Debug code
and run.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.