简体   繁体   English

如何在客户端更快地显示DropDownList数据加载?

[英]How to display DropDownList dataloading faster in client side?

I am using C# ASP.NET 3.5 in my application. 我在我的应用程序中使用C#ASP.NET 3.5。 In my application, I do have a page where a DropDownList is populated based on another DropDownList select value. 在我的应用程序中,确实有一个页面,其中基于另一个DropDownList选择值填充了DropDownList。

Each of my DropDownList has an selectedIndexChange method on its selection. 我的每个DropDownList的选择都具有selectedIndexChange方法。 Due to this data retrieval is slower. 因此,数据检索较慢。

Is there any client side AJAX tools to handle this to make it faster? 是否有任何客户端AJAX工具来处理它以使其更快? Please advise. 请指教。

I have attached an image of my page. 我已附上我的页面图片。

Yeah.There is an ajax control named CascadingDropDown 是的,有一个名为CascadingDropDown的ajax控件

  <cc1:CascadingDropDown ID="cdlportfolio" TargetControlID="ddlportfolio" 
                                        PromptValue="" ServicePath="ServiceVB.asmx" ServiceMethod="Getportfolio" runat="server" 
                                        Category="portfolio" LoadingText = "Loading..." />
$(function() {
$('#<%=ddlstate.ClientID %>').attr('disabled', 'disabled');
$('#<%=ddlcity.ClientID %>').attr('disabled', 'disabled');
$('#<%=ddlstate.ClientID %>').append('<option selected="selected" value="0">Select State</option>');
$('#<%=ddlcity.ClientID %>').empty().append('<option selected="selected" value="0">Select Region</option>');
$('#<%=ddlcountries.ClientID %>').change(function() {
var country = $('#<%=ddlcountries.ClientID%>').val()
$('#<%=ddlstate.ClientID %>').removeAttr("disabled");
$('#<%=ddlcity.ClientID %>').empty().append('<option selected="selected" value="0">Select Region</option>');
$('#<%=ddlcity.ClientID %>').attr('disabled', 'disabled');
$.ajax({
type: "POST",
url: "jQueryCascadingDropdownExample.aspx/BindStates",
data: "{'country':'" + country + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
var j = jQuery.parseJSON(msg.d);
var options;
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'
}
$('#<%=ddlstate.ClientID %>').html(options)
},
error: function(data) {
alert('Something Went Wrong')
}
});
});

Please refer the below link. 请参考以下链接。

http://www.aspdotnet-suresh.com/2013/10/jquery-cascading-dropdown-list-in-aspnet.html http://www.aspdotnet-suresh.com/2013/10/jquery-cascading-dropdown-list-in-aspnet.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM