c# - updatePanel not refreshing on radiobutton -
i trying populate dropdownlist when radio button clicked. no problem first time, sec time go initial 1 not work. meaning quote works on load, apply works when clicked, when going quote ddl not refreshed. ideas? please gentle, new this.
<asp:updatepanel id="updatepaneltoggle" runat="server" updatemode="always"> <contenttemplate> <asp:radiobutton id="radioon" checked="true" autopostback="true" runat="server" groupname="toggle" text="quote" oncheckedchanged="radioon_checkedchanged" /> <asp:radiobutton id="radiooff" autopostback="true" runat="server" groupname="toggle" text="apply" oncheckedchanged="radiooff_checkedchanged" /> <asp:dropdownlist id="dropdownlist1" runat="server"></asp:dropdownlist> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="radioon" /> <asp:asyncpostbacktrigger controlid="radiooff" /> </triggers> </asp:updatepanel>
code behind
protected void page_load(object sender, eventargs e) { if (!page.ispostback) { loadquoteurls(); } } protected void radioon_checkedchanged(object sender, eventargs e) { loadquoteurls(); } protected void radiooff_checkedchanged(object sender, eventargs e) { loadapplyurls(); } protected void loadapplyurls() { dropdownlist1.items.clear(); dropdownlist1.items.add("apply"); } protected void loadquoteurls() { dropdownlist1.items.clear(); dropdownlist1.items.add("quote"); }
i've tried code , works fine. anyway, don't need specify updatemode="always"
, set asyncpostbacktriggers
in case:
<asp:updatepanel id="updatepaneltoggle" runat="server"> <contenttemplate> <asp:radiobutton id="radioon" checked="true" autopostback="true" runat="server" groupname="toggle" text="quote" oncheckedchanged="radioon_checkedchanged" /> <asp:radiobutton id="radiooff" autopostback="true" runat="server" groupname="toggle" text="apply" oncheckedchanged="radiooff_checkedchanged" /> <asp:dropdownlist id="dropdownlist1" runat="server"> </asp:dropdownlist> </contenttemplate> </asp:updatepanel>
c# asp.net radio-button updatepanel
No comments:
Post a Comment