473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Assigning value to session in javascript in c# code behind.

Hi,
I want to assign some value to session variable in JavaScript written in c# code behind.I hv written like this:
Expand|Select|Wrap|Line Numbers
  1. string map2 ="<script language='javascript'>"<%Session["lat"]=varname;%>"; </script>";
  2. this.RegisterStartupScript("load", map2);
But it is nt working.
Please give me solution.

Thank u.
May 13 '09 #1
2 8911
NeoPa
32,556 Expert Mod 16PB
This has now been the rounds so I'm hoping this may find some help in ASP.NET.

Good luck.
Jun 11 '09 #2
Bassem
344 100+
Do you want to set a session key/value pair when a JavaScript event fires?
I made up a bad technique but it works.
I request another page using JavaScript like this:
Expand|Select|Wrap|Line Numbers
  1.     var url="CommPage.aspx";
  2.     url=url+"?way=receive";
  3.  
  4.     xmlHttpReceiver.onreadystatechange=receiverStateChanged;
  5.     xmlHttpReceiver.open("GET",url,true);
  6.     xmlHttpReceiver.send(null);
In CommPage.aspx Page_Load do whatever you want.
You can pass any parameters with their values to be set in session.

There is no reloading, no redirect occurs.
I hope it will help.
Jun 15 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jenny | last post by:
Hi, Can I create an array of tags by assigning same name to these tags? For example, I have two <p> tags with the same name t1. But document.all.b.value=document.all.t.length does not...
4
by: RA | last post by:
Session("ListBoxHold") = document.getElementById("lstCodes") The above statement gives an error "Object Expected" Any Clue?
4
by: Alex | last post by:
Is there any way to delete the value of a html hidden input field from code-behind? I use an html hidden input to store an array of data. I collect this data using Request.Form or Request.Params....
6
by: Jerry Camel | last post by:
Basic Web Form... A few text boxes and a checkbox - and a card reader... The effect I want to accomplish is this: The basic credit card fields are there and can be filled out. But if the user...
3
by: Alan Wang | last post by:
Hi there, Once my application gets complicated and complicated. I found it's really hard to keep track of Session value I am using in my asp.net application. I am just wondering if anyone have...
1
by: srinivas | last post by:
Hi I'm having a asp.net page.When i'm clicking on the Logout hyperlink i want to close the window and clear the session. Actually i have taken LinkButton control and written a javascript function...
4
by: philin007 | last post by:
Hi , I have the following javascript codes: ****************************************** <script language="JavaScript"> <!-- .... ..... if (nextRow >5) {
1
by: fatima.issawi | last post by:
Hello, I am trying to set the value of a hidden field in Javacript in my UserControl. I need to access the value in the code-behind. For some reason, the value of the hidden field never gets...
1
by: --[zainy]-- | last post by:
Hello Guyz.. I want to assign a varascript value to a session object in javascript function... like i have an image and onClick i am calling a function sort_(str).. Now i want to assign this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.