Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Jquery issue

Status
Not open for further replies.

ddombadoh

Programmer
Oct 14, 2011
3
GH
Hello All,

I am quit new in jquery. I have implemented the jquery autocomplete textbox, where I load data from SQL server. Upon selecting an item from the dropdown, I fill some controls on the form. I also want to change the text property of a button. Below is my jquery code:

==========================================================
Code:
$(function () {
        $("#<%=txtSearch.ClientID%>").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "/customers/customers.asmx/fncFetchCustomerList",
                    data: "{ 'strFullname': '" + request.term + "' }",
                    dataType: "json",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    dataFilter: function (data) { return data; },
                    success: function (data) {
                        response($.map(data.d, function (item) {
                            return {
                                value: item.Fullname,
                                Firstname: item.FirstName,
                                Email: item.Email
                            }
                        }))
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(textStatus);
                    }
                });
            },
            select: function (event, ui) {
                $('#<%=txtFName.ClientID%>').val(ui.item.Firstname);
                $('#<%=txtEmail.ClientID%>').val(ui.item.Email);
                $('#<%=btnSubmit.ClientID%>').val("Update");
            },
            minLength: 2
        });
    });
============================================================

My problem is, upon changing the text property of the button to "Update", when i run a server side code and check for the text of the button, it doesn't read "Update".
Any help on this will be appreciated.
Thank you.
 
So, you select an item in the ddl and then the button text changes. At what point in your server side code are you checking the text of the button? And what code are you using?
 
Thanks jbenson001,

I am checking the text of the button immediately it is clicked, after the selection is made. I use the following code;
Code:
If btnSubmit.Text = "Update" Then
   //do something
Elseif btnSubmit.Text = "Save" Then
   //do something
End if

Thank you.
 
So you see the text of the button get changed, then you click it and check the text?
 
Humm, I'll have to try a couple of tests to see if I get the same results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top