1
Reply

yahoo weather rss

Mei Yi

Mei Yi

Aug 16 2013 12:41 PM
1.5k
 hi, 
i want to display yahoo weather rss info in my asp.net page.

how to display different weather xml file(since each location will has its own xml file) when different options in dropdown list is selected?

for example, i have a dropdownlist. then inside my dropdown list i have several options ( option A,B,C,D and E). 

When option A is selected and click on a button i have created below it, i want to display the xml file details in DataList at the same page (below the dropdown list and button).  

However when i select oprtion B, the second xml file details will be display at the same place. 

how to do it? 

currently i am able to show the details of xml file in DataList . 

BELOW  is the code for display just one xml file detail. how to make it able to display different weather xml file based on the dropdownlist selection? please help.

waiting for reply. thanks. 

=====================<CODE in aspx>======================================


        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="http://xml.weather.yahoo.com/forecastrss?w=1154781&u=f"

            XPath="rss/channel/item"></asp:XmlDataSource>

        <asp:DataList ID="DataList1" runat="server" BackColor="White" BorderColor="#999999"

            BorderStyle="None" BorderWidth="1px" CellPadding="3" 

            DataSourceID="XmlDataSource1" GridLines="Vertical" Width="250px">

            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />

            <SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />

            <AlternatingItemStyle BackColor="#DCDCDC" />

            <ItemStyle BackColor="#EEEEEE" ForeColor="Black" />

            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />

            <ItemTemplate>        

            <%#XPath("title")%> 

            <hr/>&nbsp;<br />

           <%#XPath("description")%><br /> 

            </ItemTemplate>

        </asp:DataList>


Answers (1)