Visual Studio .NET - Dropdownlist in update panel

Asked By Manju R on 19-Mar-07 04:21 PM

I tried this sample test form and it works fine - listbox is updated on selection changed event of the other and only that portion is updated. I have to use this in my application but the dropdown boxes are in different cells/ sections in a table.

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering ="true"/>

<div>

&nbsp;</div>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode ="Conditional" >

<ContentTemplate>

<asp:DropDownList ID="DropDownList1" runat="server" DataTextField="fieldname" DataValueField="fieldname" autopostback="true" OnSelectedIndexChanged ="DropDownList1_SelectedIndexChanged">

</asp:DropDownList>

<asp:DropDownList ID="DropDownList2" runat="server" DataTextField="Text" DataValueField="Val">

</asp:DropDownList>

</ContentTemplate>

<Triggers >

<asp:AsyncPostBackTrigger ControlID ="DropDownList1" EventName ="SelectedIndexChanged" />

</Triggers>

</asp:UpdatePanel>

<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode ="conditional" >

<ContentTemplate>

<asp:Button ID="Button1" runat="server" Text="Button" /><br />

<asp:Label ID="Label1" runat="server" Text="Label" Width="152px"></asp:Label>

</ContentTemplate>

</asp:UpdatePanel>

&nbsp;

</form>

Here's the code from my form -

<td><asp:UpdatePanel ID="updateRecipe" runat="server" UpdateMode ="Conditional" >

<ContentTemplate><asp:DropDownList ID="JobDescription" runat="server" DataTextField="Text" DataValueField="val" Width="150px" CssClass ="grdData" AutoPostBack="True" OnSelectedIndexChanged ="JobDescription_SelectedIndexChanged">

</asp:DropDownList> </ContentTemplate><Triggers >

<asp:AsyncPostBackTrigger ControlID ="JobDescription" EventName ="SelectedIndexChanged" />

</Triggers></asp:UpdatePanel>

This updates two dropdown lists. Do I have to wrap all dropdownboxes in one update panel or have them in separate updatepanels? How do i trigger the events. What I have here doesn't work.

Use the ASP.NET AJAX CascadingDropDown Control - K Pravin Kumar Reddy replied to Manju R on 19-Mar-07 10:20 PM

Use the ASP.NET AJAX CascadingDropDown Control

check out example

This video demonstrates how ASP.NET’s standard DropDownList can become AJAX-enabled using the CascadingDropDown control extender from the ASP.NET AJAX Control Toolkit. You will also see how easy it is for a web form to draw its data from an XML Web Service.

http://www.asp.net/learn/videos/view.aspx?tabid=63&id=77