Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm looking for the most efficient / standard way of passing data between client-side Javascript code and C# code behind an ASP.NET application.
In my project, on button click event i have different function and i have an requirement where a loader is generating and the text of the loader change in different function that is executing in button click event.
e.g in my button click event
1.first function is saving the data,so the text of the loader should be "Saving Data"
2.Second function is retrieving information,so now the text of the same loader should be "Retrieving Information". and so on for another funtion.

for that i am using a label control and assigning that label value in every function call,and in my javascript i am assigning label value into loader Text.

but it is not working at all,text value is not exchange.

my javascript loader function is like this:

JavaScript
$(function () {

        var current_effect = 'win8';

        $('#btnSubmit').click(function () {
            var message = $("#<%=lblMessage.ClientID%>").text();
            run_waitMe(current_effect, message);
        });
function run_waitMe(effect, message) {
            $('body').waitMe({
                effect: effect,
                text: message,
                bg: 'rgba(255,255,255,0.7)',
                color: 'red'
            });
        }

    });


and in code behind i am assigning label value in different function in button click event.

C#
protected void btnSubmit_Click(object sender, EventArgs e)
    {   

 void function1()
       {
        lblMessage.text="text1";
         .........
       }
 void function2()
       {
        lblMessage.text="text1";
        ........
       }
    }


Please help me,to overcome from this situation or any other solution to do the requirement.
Posted
Updated 5-Aug-14 23:03pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900