Share via


how to avoid page refresh on selecting the dropdownlist

Question

Friday, May 11, 2012 7:13 AM

how to avoid page refresh on selecting the dropdownlist.

iam using update panel for ddlcity, when i select the city the page is getting refreshed.. even i have update panel for it.

 <asp:UpdatePanel id="UpdatePanel1" runat="server">                               
                                    <contenttemplate>
<asp:DropDownList id="ddlCity" tabIndex=15 runat="server" CssClass="DropDownStyle" AppendDataBoundItems="True" AutoPostBack="True" DataTextField="Name" DataValueField="CityId" OnSelectedIndexChanged="ddlCity_SelectedIndexChanged"></asp:DropDownList>*<BR /><BR /><asp:DropDownList id="ddlLocation" tabIndex=16 runat="server" CssClass="DropDownStyle" AppendDataBoundItems="True"  DataTextField="Name" DataValueField="LocationId"><asp:ListItem Value="0">Select</asp:ListItem>
</asp:DropDownList>*
<asp:UpdateProgress id="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="50">
<ProgressTemplate>
  <img src="Images/preloader1.gif" style="width: 27px; height: 24px"/>                                             
</ProgressTemplate>
</asp:UpdateProgress>
</contenttemplate>
                                </asp:UpdatePanel>

on selectedindexchange the whole page is getting refreshed.

How to avoid it.

Thanks in advance

All replies (4)

Friday, May 11, 2012 9:08 AM âś…Answered

put scriptManager on page

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
 </ContentTemplate>
</asp:UpdatePanel>


Friday, May 11, 2012 7:18 AM

Is there scriptmanager . If not, add it


Friday, May 11, 2012 8:52 AM

Change AutoPostBack="True" to AutoPostBack="False" in <asp:DropDownList>


Wednesday, October 3, 2012 5:21 AM

if i change to false autopostback while selecting ddl it will not change Output ??