oliviacamel
New Member
I am trying to pass a JavaScript variable to a server-side tag to avoid a post-back. I'd like the solution to look something like this:Code Behind:\[code\]Public Property NameCollection As Dictionary(Of String, String)\[/code\]JavaScript that I wish to have:\[code\]$('#<%= txtIDNumber.ClientID %>').change(function(){ var idNumber = $('#<%= txtIDNumber.ClientID %>').val(); var lblName = $('#<%= lblName.ClientID %>'); <%If NameCollection.ContainsKey(idNumber) Then %> lblName.html('<%=NameCollection(idNumber)%>'); <%Else%> lblName.html('<span class="error">Not a User</span>'); <%End If %>});\[/code\]These server-side tags work properly if I hard-code the idNumber (say '1234' or something), so I know my object/code itself is working properly, but is there a way to get it to recognize/pass the JavaScript variable here?Extra Info:I do have a functional work-around, but it is the ugly and inefficient method of looping through all the items in the collection, so I would like to know how to do this better if there is a way to. Thanks for help.