我怎么知道级联下拉菜单已加载
我在网络表单中使用了级联下拉菜单(用于品牌和型号)。我正在使用 webservice 中的 webmethod 来绑定 CDD。
以下是代码 -
<asp:DropDownList ID="ddlMakes" runat="server" Width="150px">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cddMakes"
runat="server"
Category="Makes"
TargetControlID="ddlMakes"
PromptText="-Select Make-"
LoadingText="Loading Makes..."
ServicePath="~/VehicleMakeModelProviderService.asmx"
ServiceMethod="Service_GetMakes">
</cc1:CascadingDropDown>
<asp:DropDownList ID="ddlModels" runat="server" Width="150px">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cddModels"
runat="server"
Category="Models"
TargetControlID="ddlModels"
ParentControlID = "ddlMakes"
PromptText="-Select Models-"
LoadingText="Loading Models.."
ServicePath="~/VehicleMakeModelProviderService.asmx"
ServiceMethod="Service_GetModels">
</cc1:CascadingDropDown>
我已在隐藏字段中保存了两个控件的选定值。当我尝试在 Page_Load 上设置所选值时,会引发异常。我注意到发生这种情况是因为 DDL 在整个页面加载后被填充。
有什么方法可以知道 DDL 是否已填充,以便我也可以使用 javascript 设置所选值。
感谢您分享您的时间。
以下是一些图片供您参考。 [由于某种原因我删除了这些图像]
I have used Cascading Drop Downs (for Make and Model) in my web form. I am using webmethod from webservice to bind the CDDs.
Following is the code -
<asp:DropDownList ID="ddlMakes" runat="server" Width="150px">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cddMakes"
runat="server"
Category="Makes"
TargetControlID="ddlMakes"
PromptText="-Select Make-"
LoadingText="Loading Makes..."
ServicePath="~/VehicleMakeModelProviderService.asmx"
ServiceMethod="Service_GetMakes">
</cc1:CascadingDropDown>
<asp:DropDownList ID="ddlModels" runat="server" Width="150px">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cddModels"
runat="server"
Category="Models"
TargetControlID="ddlModels"
ParentControlID = "ddlMakes"
PromptText="-Select Models-"
LoadingText="Loading Models.."
ServicePath="~/VehicleMakeModelProviderService.asmx"
ServiceMethod="Service_GetModels">
</cc1:CascadingDropDown>
I have saved selected values for both the controls in hidden fields. When I am trying to set the selected value on Page_Load and exception is raised. I noticed that this is happening because of the DDLs are filled after entire page is loaded.
Is there any way to know that the DDLs are filled so that i could set the selected value using javascript as well.
Thanks for sharing your time.
Following are some images for your reference.
[For some reason i have deleted those images]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看 ready() 处理程序..可能会对您有所帮助。
Have a look at the ready() handler..might help you.