Introduction
The Microsoft ASP. NET technologies helps to build websites, and the web sites may be contain image sliders. When you want to put an image control in your website and attach many images with this control, and then if you want this image control to automatically rotate those images then I think the first thing you must do it with Ajax, for that you create a XML file as described here.
XmlFile.XML
Note: add a XML file along with your website in the Solution Explorer, then right-click on the XML page thenselect "Properties" -> "Schemas" , then add the Schema name "adrotator.xsd" then write the following code:
- <?xml version="1.0" encoding="utf-8" ?>
- <Advertisements>
- <Ad>
- <ImageUrl>http://localhost:64916/images/img2.jpg</ImageUrl>
- </Ad>
- <Ad>
- <ImageUrl>http://localhost:64916/images/img3.jpg</ImageUrl>
- </Ad>
- <Ad>
- <ImageUrl>http://localhost:64916/images/img4.jpg</ImageUrl>
- </Ad>
- </Advertisements>
After creating this file, drag and drop the ScriptManager control on the top of your "aspx" page in the design site then drag and drop the UpdatePanel and Timer control from the AJAX Extensions then drag and drop an AdRotator control and put it into the UpdatePanel. You must also place the timer control inside the UpdatePanel. Simply set the timer control's "interval" property and add the "advertisement file", in other words the previously created "XML file" into the AdRotator "advertisement file" properties.
Simply run your website, the image rotator will work properly.
Source Code
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Debug="true"%>
- <!DOCTYPE html>
- <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:UpdatePanel ID="UpdatePanel1" runat="server">
- <ContentTemplate>
- <asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/XMLFile.xml" />
- <asp:Timer ID="Timer1" runat="server" Interval="2000">
- </asp:Timer>
- </ContentTemplate>
- </asp:UpdatePanel>
- </div>
- </form>
- </body>
- </html>



Akash BinwalPosted Dec 7, 2018, 2:07 AM
Hi sharad, here we use ad rotator what if i want o apply image sliding over whole page then how to do this?
Hammer ClassPosted Nov 3, 2015, 12:51 PM
how to add link on images in slider
Naveed ZamanPosted May 13, 2013, 8:11 AM
very nice. Do you have source code as well?. please attach if possible.