Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Loop through Ajax Combobox items client side and retreive text and value

$
0
0

Hi,

       I need to loop through the AJAX Combobox client side and retreive the text and value of the items.  I have defined the combobox as

<ajaxToolkit:ComboBox ID="ajxCbxSuppName" ClientIDMode="Static" DataSourceID="SqlDataSource1"  RenderMode="Block" CssClass="txtBoxClass1 WindowsStyle" AutoPostBack="False" AutoCompleteMode="Suggest" runat="server" DataTextField="SUPPLIER_NAME" DataValueField="ID" MaxLength="0" AppendDataBoundItems="true" DropDownStyle="DropDown"></ajaxToolkit:ComboBox><asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString='<%$ ConnectionStrings:conString %>' SelectCommand="SELECT [SUPPLIER_NAME], [ID] FROM [SUPPLIER_MAST] ORDER BY [SUPPLIER_NAME]"></asp:SqlDataSource>

I have used the following function to loop through the items

$(function () {
                                alert("awit");$("<%=ajxCbxSuppName.ClientID%> option").each(function (i) {
                                    alert("awit888");
                                    alert($(this).text() + " : " + $(this).val());
                                });
                            });

But it doesn't enter the function at all. The combobox ID is not recognized . How else can i refer the ID to make it work.

Please help

Regards

Sanjish


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>