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:

$(function () {
            source: function (request, response) {
                    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) {
            select: function (event, ui) {
            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.

5 Years
Discussion Span
Last Post by nakor77

The problem is going to most likely be caused because of viewstate. You are updating the text of the button on the client side which does not update the page's viewstate. When the postback occurs and the page fetches the viewstate data it will not see the updated text value for that button. One option you might try is to add a HiddenField control to the page and set it's value to "Update" in the select function of the autocomplete as well as the submit buttons text value. Then in the code behind access the hiddenfield value instead of trying to read the button's text value.

Edited by nakor77: edit

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.