add rotator:
aspx code
<asp:UpdatePanel ID="up1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:AdRotator
id="AdRotator1"
AdvertisementFile="~/admin/XMLFile.xml"
KeywordFilter="small"
Runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
xml insert code:
public void xmlinsert()
{
XmlDataDocument xmldoc = new XmlDataDocument();
xmldoc.Load(MapPath("~/admin/XMLFile.xml"));
XmlElement parentelement = xmldoc.CreateElement("Ad");
XmlElement imurl = xmldoc.CreateElement("ImageUrl");
imurl.InnerText = "~/images" + "/" + FileUpload1.FileName;
parentelement.AppendChild(imurl);
XmlElement width = xmldoc.CreateElement("Width");
width.InnerText = "206";
parentelement.AppendChild(width);
XmlElement height = xmldoc.CreateElement("Height");
height.InnerText = "200";
parentelement.AppendChild(height);
XmlElement navigate = xmldoc.CreateElement("NavigateUrl");
navigate.InnerText = "http://labtestdiagnosis.com/index.aspx";
parentelement.AppendChild(navigate);
XmlElement imression = xmldoc.CreateElement("Impressions");
imression.InnerText = "40";
parentelement.AppendChild(imression);
XmlElement keyword = xmldoc.CreateElement("Keyword");
keyword.InnerText = "small";
parentelement.AppendChild(keyword);
xmldoc.DocumentElement.AppendChild(parentelement);
xmldoc.DocumentElement.AppendChild(parentelement);
xmldoc.DocumentElement.AppendChild(parentelement);
xmldoc.DocumentElement.AppendChild(parentelement);
mldoc.DocumentElement.AppendChild(parentelement);
mldoc.DocumentElement.AppendChild(parentelement);
xmldoc.Save(Server.MapPath("~/admin/XMLFile.xml"));
}
xml file
:
<?xml version="1.0" encoding="utf-8"?>
<Advertisements>
<Ad>
<ImageUrl>~/images/5_step.jpg</ImageUrl>
<Width>206</Width>
<Height>200</Height>
<NavigateUrl>http://www.dotnetcurry.com</NavigateUrl>
<AlternateText>DotNetCurry Home Page</AlternateText>
<Impressions>40</Impressions>
<Keyword>small</Keyword>
</Ad>
<Ad>
<ImageUrl>~/images/arrow.jpg</ImageUrl>
<Width>206</Width>
<Height>200</Height>
<NavigateUrl>http://www.sqlservercurry.com</NavigateUrl>
<AlternateText>SQL Server Curry Home Page</AlternateText>
<Impressions>20</Impressions>
<Keyword>small</Keyword>
</Ad>
<Ad>
<ImageUrl>~/images/content_section_bg.jpg</ImageUrl>
<Width>206</Width>
<Height>200</Height>
<NavigateUrl>http://www.dotnetcurry.com/writeforus.aspx</NavigateUrl>
<AlternateText>dotnetcurry.com Write For Us</AlternateText>
<Impressions>40</Impressions>
<Keyword>small</Keyword>
</Ad>
<Ad>
<ImageUrl>~/images/amit.jpg</ImageUrl>
<Width>206</Width>
<Height>200</Height>
<NavigateUrl>http://labtestdiagnosis.com/index.aspx</NavigateUrl>
<Impressions>40</Impressions>
<Keyword>small</Keyword>
</Ad>
</Advertisements>
aspx code
<asp:UpdatePanel ID="up1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:AdRotator
id="AdRotator1"
AdvertisementFile="~/admin/XMLFile.xml"
KeywordFilter="small"
Runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
xml insert code:
public void xmlinsert()
{
XmlDataDocument xmldoc = new XmlDataDocument();
xmldoc.Load(MapPath("~/admin/XMLFile.xml"));
XmlElement parentelement = xmldoc.CreateElement("Ad");
XmlElement imurl = xmldoc.CreateElement("ImageUrl");
imurl.InnerText = "~/images" + "/" + FileUpload1.FileName;
parentelement.AppendChild(imurl);
XmlElement width = xmldoc.CreateElement("Width");
width.InnerText = "206";
parentelement.AppendChild(width);
XmlElement height = xmldoc.CreateElement("Height");
height.InnerText = "200";
parentelement.AppendChild(height);
XmlElement navigate = xmldoc.CreateElement("NavigateUrl");
navigate.InnerText = "http://labtestdiagnosis.com/index.aspx";
parentelement.AppendChild(navigate);
XmlElement imression = xmldoc.CreateElement("Impressions");
imression.InnerText = "40";
parentelement.AppendChild(imression);
XmlElement keyword = xmldoc.CreateElement("Keyword");
keyword.InnerText = "small";
parentelement.AppendChild(keyword);
xmldoc.DocumentElement.AppendChild(parentelement);
xmldoc.DocumentElement.AppendChild(parentelement);
xmldoc.DocumentElement.AppendChild(parentelement);
xmldoc.DocumentElement.AppendChild(parentelement);
mldoc.DocumentElement.AppendChild(parentelement);
mldoc.DocumentElement.AppendChild(parentelement);
xmldoc.Save(Server.MapPath("~/admin/XMLFile.xml"));
}
xml file
:
<?xml version="1.0" encoding="utf-8"?>
<Advertisements>
<Ad>
<ImageUrl>~/images/5_step.jpg</ImageUrl>
<Width>206</Width>
<Height>200</Height>
<NavigateUrl>http://www.dotnetcurry.com</NavigateUrl>
<AlternateText>DotNetCurry Home Page</AlternateText>
<Impressions>40</Impressions>
<Keyword>small</Keyword>
</Ad>
<Ad>
<ImageUrl>~/images/arrow.jpg</ImageUrl>
<Width>206</Width>
<Height>200</Height>
<NavigateUrl>http://www.sqlservercurry.com</NavigateUrl>
<AlternateText>SQL Server Curry Home Page</AlternateText>
<Impressions>20</Impressions>
<Keyword>small</Keyword>
</Ad>
<Ad>
<ImageUrl>~/images/content_section_bg.jpg</ImageUrl>
<Width>206</Width>
<Height>200</Height>
<NavigateUrl>http://www.dotnetcurry.com/writeforus.aspx</NavigateUrl>
<AlternateText>dotnetcurry.com Write For Us</AlternateText>
<Impressions>40</Impressions>
<Keyword>small</Keyword>
</Ad>
<Ad>
<ImageUrl>~/images/amit.jpg</ImageUrl>
<Width>206</Width>
<Height>200</Height>
<NavigateUrl>http://labtestdiagnosis.com/index.aspx</NavigateUrl>
<Impressions>40</Impressions>
<Keyword>small</Keyword>
</Ad>
</Advertisements>
No comments:
Post a Comment