If you don't want to refresh the page, don't think the cookie will work either, plus that's not a great habit to get into.
You might want to take a look into AJAX: http://www.adaptivepath.com/publications/essays/archives/000385.php which lets you query the server from the web page without doing a full postback. This is the technology that the gmail client uses. You can also do soemthing very similar going a web services call from from your javascript. Here's a link, the one downside is that I believe it is limited to IE browser suppport, http://msdn.microsoft.com/library/default.asp?url=/workshop/author/webservice/using.asp Here's some info on doing it in ASP.NET 2.0., which I THINK will cross browser compatiable, but I haven't played with it myself. http://msdn.microsoft.com/msdnmag/issues/04/08/CuttingEdge/ On 5/17/05, Eva Li <[EMAIL PROTECTED]> wrote: > Dean, > > Thank you very much for your reminding. My app is in a discussion mode. > When my server side (aspx.cs) has some changes, my aspx page, could > be another aspx page, needs to know in order to update UI without refreshing > the page. Using Session is not an option. I will try using cookie. Server > side can change the cookie value and then my javascripts can read the cookie > value. Is this an option? > > Eva > > Dean Fiala <[EMAIL PROTECTED]> wrote: > An important thing to remember is that session objects run on the > SERVER, while javascripts run on the CLIENT (Browser). The javascript > can only interact with objects actually on the page or objects created > by other client-side scripts, they cannot directly interact with > server objects such as session variables. > > So, no, you cannot directly access a session object from javascript. > > If you want to expose the values in a session object (or any server > side variable) to your client-side script, you need to do so by > generating/filling values into html controls or xml islands on the > page. You could also dynamically produce javascript when the page > loads to produce objects you can access via javascript. > > Of course, once you have let the user update the objects on the > client, you need to access the values on the server. The most > straightforward method is to simply post the form back and let the > server read through the values in the html controls. You could also > get very fancy and call the server from the browser using web services > methods, but that's a discussion for another day. > > On 5/17/05, Eva Li <[EMAIL PROTECTED]> wrote: > > Objects in session can be easily accessed across aspx pages. > > Here is how I store and access my objects: > > > > Object myObject = Object (some thing). > > Session["MyObj"] = myObject > > > > This object can be accessed in another page (code behind): > > > > Object myObject = Session["MyObj"] as Object > > > > Questions: Can I access this object stored in Session from my > > JavaScripts/Functions in my aspx page? Or is there any alternative? > > Here, I'd like to communicate between my aspx and aspx.cs accessing > > same object. > > > > Thanks! > > > > Eva > > > > > > [Non-text portions of this message have been removed] > > > > Yahoo! Groups Links > > > > > > > > > > > > -- > Dean Fiala > Very Practical Software, Inc > http://www.vpsw.com > > --------------------------------- > Yahoo! Groups Links > > To visit your group on the web, go to: > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ > > To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. > > > [Non-text portions of this message have been removed] > > Yahoo! Groups Links > > > > > -- Dean Fiala Very Practical Software, Inc http://www.vpsw.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
