Help with Making First control

Topics: ASP.NET 2.0, Controls
Jul 30, 2010 at 5:56 PM
Edited Oct 24, 2011 at 8:39 PM

I need to know how to connect a control to the xml file for data?

I looked at the controls for blogroll.cs and categories.cs

I could not find any code in them that points to their xml file  blogroll.xml or categories.xml

What I want to do is create an control that gets data from an xml file and then display it on a static page

within a html table.

That is the first step I want to do with this control.

 

I have a website http://www.free07.somee.com/FreeTrials.aspx  which I am converting into BE.Net

 

The URL above  has the following code:

 

 

<asp:Content ID="Content2" ContentPlaceHolderID="CenterContentHolder" Runat="Server">


<center><h1>100% Free Trials </h1></center>


<br/><br/>


      <asp:XmlDataSource
        id="XmlSource"
        DataFile="App_Data\FreeTrials.xml"
        runat="server"
        XPath= "/FreeInfoOffersRoot/Offer[Av='Yes']" />
       
<asp:Repeater ID="Repeater1"
        DataSourceID="XmlSource"
        runat="server">


<HeaderTemplate>


<table border ="2" cellpadding="0" cellspacing="0" >

<tr>
<th>Free Trials</th>
<th>Information</th>
<th>Credit Card Needed?</th>

</tr>

</HeaderTemplate>

<ItemTemplate>
<tr>
<td><%#XPath("ImageLink")%>  <%#XPath("Av")%>     </td>

<td>
<%#XPath("Title")%> 
<%#XPath("Info")%>
</td>

<td><%#XPath("CreditCard")%></td>

</tr>

</ItemTemplate>

<AlternatingItemTemplate>
<tr>
<td><%#XPath("ImageLink")%></td>

<td>
<%#XPath("Title")%> 
<%#XPath("Info")%>

</td>

<td><%#XPath("CreditCard")%></td>

</tr>
</AlternatingItemTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

</asp:Repeater>

<br /> <br />



</asp:Content>

 

I would like the control to do the code above.

 

Any help would be great!

 

Thanks,

 

Brian Davis


Java Blog