I have have 2 DropDownList controls with CascadingDropDown
I need set data to the first dropdownlist on server side if i do this, and when i get page on client side, the first DropDownList without data that i set on server side
Thanks for any help
//client
&开发者_开发百科lt;asp:DropDownList ID="ddlAjaxManufacturer" runat="server">
</asp:DropDownList>
<ajaxToolkit:CascadingDropDown ID="CascadingDropDownManufacturer" runat="server"
TargetControlID="ddlAjaxManufacturer" Category="Make" PromptText="....." ServicePath="../../Ajax.asmx"
ServiceMethod="GetMakes" />
<asp:DropDownList BackColor="white" ID="ddlAjaxModel" runat="server">
</asp:DropDownList>
<ajaxToolkit:CascadingDropDown ID="CascadingDropDownModel" runat="server" TargetControlID="ddlAjaxModel"
ParentControlID="ddlAjaxManufacturer" PromptText="....." ServiceMethod="GetModelsForMake"
ServicePath="../../Ajax.asmx" Category="Model" />
//server
ddlAjaxManufacturer.Items.Add(new ListItem("...", "", true));
ddlAjaxManufacturer.Items.Add(new ListItem("11", "ford", true));
ddlAjaxManufacturer.Items.Add(new ListItem("22", "bmw", true));
What your trying to do may work but in a different scenario. have you tried to use a web service to populate your dropdownlists? as far as i know CascadingDropDown works with a web service in order to populate the drop down buttons using ajax, did you see this video ?
http://www.asp.net/ajax/videos/use-aspnet-ajax-cascading-drop-down-control-to-access-a-database
it shows how CascadingDropDown extender works
精彩评论