Change a Javascript variable value from code behind

Viewed 17985

I have this javascript code:

<script>
$(document).ready(function() {
    var progValue1 = 100;
    var progValue2 = 30; 
    $("#progressbar").progressbar({ value: progValue1});
    $("#progressbar2").progressbar({ value: progValue2 });
});
</script>

I would like to change the values of the two variables (progValue1 and progValue2) from the code behind when a button is clicked .....

This is the code for the button

<asp:Button ID="btnConfirm" CssClass="button" SkinID="Common" runat="server" Text=  "Confirm" OnClick="btnConfirm_Click" />

How can I change those values from the C# code for the btnConfirm method?

3 Answers
$(function () {
        var progValue1 = parseInt('<%=ProgValue1%>');
        $("#progressbar").progressbar({ value: progValue1 });
    });


private int _progValue1 = 1;

    protected int ProgValue1
    {
        get
        {
            return _progValue1;
        }
    }
Related