我希望第一次初始化的绑定由我的aspx页面来绑定记录中的数据。
比如有两个dropdownlist : root和sub,在打开页面时已经打开了一条记录,而记录中的root和sub的值我希望绑定上去。
在用户点它们改变选择时CascadingDropDown才跟进。
如果不这样,一开始打开页面CascadingDropDown就会绑定root和sub的选择项,要不就是显示请选择,要不就是显示第一条。这都不是我希望的。
比如有两个dropdownlist : root和sub,在打开页面时已经打开了一条记录,而记录中的root和sub的值我希望绑定上去。
在用户点它们改变选择时CascadingDropDown才跟进。
如果不这样,一开始打开页面CascadingDropDown就会绑定root和sub的选择项,要不就是显示请选择,要不就是显示第一条。这都不是我希望的。
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlProvince" runat="server">
</asp:DropDownList><asp:DropDownList ID="ddlCity" runat="server">
</asp:DropDownList><asp:DropDownList ID="ddlVilliage" runat="server">
</asp:DropDownList>
<ajax:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="ddlProvince" ServicePath="SNWebService.asmx" ServiceMethod="GetProvinceContents" Category="Province" PromptText="请选择省份" LoadingText="省份加载中...">
</ajax:CascadingDropDown>
<ajax:CascadingDropDown ID="CascadingDropDown1" runat="server" ParentControlID="ddlProvince" ServicePath="SNWebService.asmx" ServiceMethod="GetCityContents" Category="City" TargetControlID="ddlCity" PromptText="请选择城市" LoadingText="城市加载中...">
</ajax:CascadingDropDown>
<ajax:CascadingDropDown ID="CascadingDropDown3" runat="server" Category="Villiage" LoadingText="区县加载中..."
ParentControlID="ddlCity" PromptText="请选择区县" ServiceMethod="GetViliageContents"
ServicePath="SNWebService.asmx" TargetControlID="ddlVilliage">
</ajax:CascadingDropDown>
</ContentTemplate>
</asp:UpdatePanel>
是要这个意思 ???????
由数据库中的某一条记录来决定。当我切换记录时,两极的selectedValue都要跟着联动。
由于不知道异步的cascadingdropdown的binding什么时候完成,所以要设置它的selectedValue和自己的记录里选择的值一致。
这样就能既有级联的菜单,又能自己绑定选择的值。
当然这样绑定了两次,有点浪费资源,但是没办法,在render页面的时候也许cascadingDropDown还没有连接webservice呢。