Connecting to a database
System.usecodepage = true;
_global.arrtitle = new Array (5);
_global.arrimage = new Array (5);
_global.arrurl = new Array (5);
function Loadxml ()
{
myXML = new XML ();
Myxml.ignorewhite = true;
Myxml.load ("http://192.168.0.244/8mchina2/flash/tvindex.aspx");
Myxml.onload = function (Success)
{
if (success)
{
len = myxml.firstChild.childNodes.length;
for (i=0; i<5; i++)
{
_global.arrtitle[i] = Myxml.firstchild.childnodes[i].attributes.title;
_global.arrimage[i] = myxml.firstchild.childnodes[i].attributes.image;
_global.arrurl[i] = Myxml.firstchild.childnodes[i].attributes.url;
Eval ("_root.txt" + (i+1)). Text = _global.arrtitle[i];
}
}
Else
{
Loadxml ();
}
};
}
Loadxml ();
aspx file processing:
<%@ Import namespace= "Bmhd.Components.Components"%>
<%@ Import namespace= "Bmhd.components"%>
<%@ Page language= "C #" codebehind= "TVIndex.aspx.cs" autoeventwireup= "false" inherits= "Bmhd.Web.xml.TVIndex"%> <?xml version= "1.0" encoding= "gb2312"?>
<xml>
<asp:repeater id= "Repeater1" runat= "Server" >
<ItemTemplate>
<item id= "<%# DataBinder.Eval (Container.DataItem," id ")%>" title= "<%# DataBinder.Eval ( Container.DataItem, "Title")%> "Url=" <%# DataBinder.Eval (Container.DataItem, "Link")%> "image=" <%# Topicpicture.getpictureurl (DataBinder.Eval (Container.DataItem, "ImageUrl"). ToString ())%> "/>
</ItemTemplate>
</asp:Repeater>
</xml>
Background code:
private void Page_Load (object sender, System.EventArgs e)
{
Place user code here to initialize page
//
Response.ContentType = "Text/xml";
Repeater1.datasource = Topics.gettop5tvindex (). topics;
Repeater1.databind ();
}