Thursday, 30 June 2011

How to use session variables in javascript function of .aspx page

<head runat="server">
    <title>Payment Page</title>
    <script language="javascript" type="text/javascript">

     function checkSession()
    {
        var cid='<% =Session["CustomerId"] %>';
        if(cid!=null && cid!="")
        {
            return true;
        }
        else
        {
            alert("your session is expired plz login");
            return false;
        }
    }
    </script>
</head>
<asp:Button ID="btnSave" runat="server" Text="Save" OnClientClick="javascript:return checkSession();" OnClick="btnSave_Click" />

tag: session variable in javascript fuction in asp.net, Using of Session Variable in asp.net

No comments:

Post a Comment

Parsing JSON w/ @ symbol in it

To read the json response like bellow @ concatenated with attribute                             '{ "@id": 1001, "@name&q...