Hi,
I am trying to update the page using AJAX but its not working. I have a
Dropdownmenu . On selection of the item in the
Dropdownmenu , i am trying to bind the values in a
Repeater control . But i dont want any postback to occur so everything is inside the update panel.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="GenrePanel" runat="server">
<ContentTemplate>
<div class="columnheader">
Music News:
<asp:DropDownList ID="Genres" runat="server" AutoPostBack="True" OnSelectedIndexChanged="Genres_SelectedIndexChanged">
<asp:ListItem Text="Rock" Value="RockFeed.xml" Selected="true" />
<asp:ListItem Text="Jazz" Value="JazzFeed.xml" />
<asp:ListItem Text="Blues" Value="BluesFeed.xml" />
</asp:DropDownList>
</div>
<asp:Repeater ID="GenreNews" runat="server" DataSourceID="GenreSource">
<ItemTemplate>
<div class="newshead">
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#XPath("link") %>' Text='<%#XPath("title") %>' />
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%#XPath("link") %>' Text="[read more]" />
</div>
</ItemTemplate>
</asp:Repeater>
<hr />
Last Updated:
<%= DateTime.Now.ToLongTimeString() %>
<asp:XmlDataSource ID="GenreSource" runat="server" DataFile="RockFeed.xml"
XPath="RockFeed"></asp:XmlDataSource>
</ContentTemplate>
</asp:UpdatePanel>
The code behind file contains the following code:-
protected void Genres_SelectedIndexChanged(object sender,EventArgs e)
{
UpdateGenre();
}
private void UpdateGenre()
{
GenreSource.DataFile = Genres.SelectedValue;
GenreNews.DataBind();
}
I am depicting one of the xml file:-
<?xml version="1.0" encoding="utf-8" ?>
<RockFeed>
<option1>Rock1</option1>
<option2>Rock2</option2>
<option3>Rock3</option3>
<option4>Rock4</option4>
<option5>Rock5</option5>
</RockFeed>
please any help is appreciated..
Thanks and Regards
Akiii