Guruji Point - Code You Want To Write

  • Home
  • Asp.Net
  • WCF
  • SQL
  • Type Script
  • AngularJS
  • Tech News
  • Blog
  • Earn Online

Sunday, 18 June 2017

Read Session Variable Value Using JavaScript or jQuery In Asp.Net

 asp.net, javascript, jquery     No comments   


Introduction
In this article we will learn How to read session value using javascript. Read session using jquery. Use session in client side using javascript and jquery.

Previous Updates

In previous articles we have learnt what is TypeScript and How to Install this on VS2015 .AngularJS basics,  Best basic C# interview questions. Transform multiple rows into one comma separated string column.

Practice

Here i am sharing code through which you can achieve this task in a very easy way. Here is the design page of this example which describe how your page looks like.
Aspx page code

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Read Session Variable Value Using JavaScript or jQuery</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript">
        $(function () {
            var value = 'This is the value of  
               ' + ' <%= Session["SessionValue"] %>'
            $('#lbldisplaySession').text(value)
});
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <label id="lbldisplaySession" />
        </div>
    </form>
</body>
</html>

Note - Here i am using cloud reference of jquery library. So you don't need to worry about download and referenced that jquery file.

.Cs page Code

protected void Page_Load(object sender, EventArgs e)
    {
        Session["SessionValue"] = "My Session";
    }

And now run the application and you have done it.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Facebook Updates

Guruji Point

Categories

Comman table Expression in SQL Dynamic Grid Row IQueryable in c# Learn AngularJS Scope_Identity() Use of indexes comma seperated string in sql row_number() and dense_rank() salary table structure. while loop in sql why do we need cursor why tuple used

About Us

This blog is about the Programming ,Tech News and some intresting facts related Contents. Here you can find fundamental and expert level topic of programming languages very practically related to C# , Asp.Net ,Sql-Server, JavaScript, Jquery, WebServices And also Web-Api, WCF ,WPF, Angular Js.

Contact Us

Email Us - gurujipoints@gmail.com
Contact- 8077657477

Reach Us

Copyright © Guruji Point - Code You Want To Write