AJAX CascadingDropDown无刷新绑定dropdownlist取text时是全部的text
各位大虾:
小弟用asp.net ajax 做了个dropdownlist联动,但是我还要取每个dropdown的 text 值,我用js取值的时候发现尽然是这个drop的所有text的加总,请问如何解决这个奇怪的问题???
代码如下:
$("#ctl00_ContentPlaceHolder1_HiddenField1").val($("#ctl00_ContentPlaceHolder1_ddlCity").text()) ;
$("#ctl00_ContentPlaceHolder1_HiddenField2").val($("#ctl00_ContentPlaceHolder1_ddlVilliage").val()) ;
$("#ctl00_ContentPlaceHolder1_HiddenField3").val($("#ctl00_ContentPlaceHolder1_ddlLocation").val()) ;
alert($("#ctl00_ContentPlaceHolder1_HiddenField1").val());
// 如:南京市无锡市…… 它把这个text加取出来了,而val() 只会取当前的value,我只想要text。而value还有其它的用途。。。
<asp:UpdatePanel id="UpdatePanel1" runat="server">
<contenttemplate>
<TABLE style="WIDTH: 802px"><TBODY><TR><TD style="HEIGHT: 26px" colSpan=4><asp:DropDownList id="ddlProvince" OnChange="chg()" runat="server" __designer:wfdid="w2">
</asp:DropDownList> <asp:DropDownList id="ddlCity" OnChange="chg()" runat="server" __designer:wfdid="w3" AutoPostBack="True">
</asp:DropDownList> <asp:DropDownList id="ddlVilliage" OnChange="chg()" runat="server" __designer:wfdid="w4">
</asp:DropDownList> <asp:TextBox id="tbStreet" runat="server" Width="102px" __designer:wfdid="w5"></asp:TextBox>路<asp:TextBox id="tbJD" runat="server" Width="63px" __designer:wfdid="w13"></asp:TextBox>号<asp:DropDownList id="ddlLocation" runat="server" __designer:wfdid="w6"></asp:DropDownList> <asp:TextBox id="tbLD" runat="server" Width="40px" __designer:wfdid="w7"></asp:TextBox>栋<asp:TextBox id="tbLDY" runat="server" Width="39px" __designer:wfdid="w8"></asp:TextBox>单元<asp:TextBox id="tbLNo" runat="server" Width="37px" __designer:wfdid="w9"></asp:TextBox>室 <asp:RegularExpressionValidator id="RegularExpressionValidator7" runat="server" Width="9px" ValidationExpression="^[0-9]*" ErrorMessage="*" ControlToValidate="tbLNo" __designer:wfdid="w10"></asp:RegularExpressionValidator> <asp:RegularExpressionValidator id="RegularExpressionValidator6" runat="server" Width="9px" ValidationExpression="^[0-9]*" ErrorMessage="*" ControlToValidate="tbLDY" __designer:wfdid="w11"></asp:RegularExpressionValidator> <asp:RegularExpressionValidator id="RegularExpressionValidator5" runat="server" Width="9px" ValidationExpression="^[0-9]*" ErrorMessage="*" ControlToValidate="tbLD" __designer:wfdid="w12"></asp:RegularExpressionValidator></TD></TR></TBODY></TABLE><Ajax:CascadingDropDown id="CascadingDropDown2" runat="server" __designer:wfdid="w55" Category="Province" LoadingText="省份加载中..." PromptText="请选择省份" ServiceMethod="GetProvinceContents" ServicePath="../SNWebService.asmx" TargetControlID="ddlProvince" SelectedValue="320000">
</Ajax:CascadingDropDown><Ajax:CascadingDropDown id="CascadingDropDown1" runat="server" __designer:wfdid="w56" Category="City" LoadingText="城市加载中..." PromptText="请选择城市" ServiceMethod="GetCityContents" ServicePath="../SNWebService.asmx" TargetControlID="ddlCity" SelectedValue="320100" ParentControlID="ddlProvince">
</Ajax:CascadingDropDown> <asp:HiddenField id="HiddenField1" runat="server" __designer:wfdid="w3"></asp:HiddenField> <asp:HiddenField id="HiddenField2" runat="server" __designer:wfdid="w4"></asp:HiddenField> <asp:HiddenField id="HiddenField3" runat="server" __designer:wfdid="w5"></asp:HiddenField> <Ajax:CascadingDropDown id="CascadingDropDown3" runat="server" __designer:wfdid="w57" Category="Villiage" LoadingText="区县加载中..." PromptText="请选择区县" ServiceMethod="GetViliageContents" ServicePath="../SNWebService.asmx" TargetControlID="ddlVilliage" ParentControlID="ddlCity">
</Ajax:CascadingDropDown> <Ajax:CascadingDropDown id="CascadingDropDown4" runat="server" __designer:wfdid="w58" Category="Location" LoadingText="小区加载中..." PromptText="请选择小区" ServiceMethod="GetLocationContents" ServicePath="../SNWebService.asmx" TargetControlID="ddlLocation" ParentControlID="ddlVilliage">
</Ajax:CascadingDropDown>
</contenttemplate>