Solved

asp panel

Posted on 2004-09-22
9
641 Views
Last Modified: 2012-05-05
Hi Experts,

Is there any way to do get some session variable value into asp:panel element onMouseOver event ?

Thank you.
0
Comment
Question by:fpoyavo
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 2

Expert Comment

by:netjkus
ID: 12125785
Store the session value in a variable on Mouseover event,

then access the value in the element  Text as <%#DataBinder.Eval(Container.DataItem, "SessionVar")%>

0
 
LVL 1

Author Comment

by:fpoyavo
ID: 12126098
Netjkus,

Not following. Please more details.
I already have session variable populated in another class.
I need just to access it onmouseover texbox without Javascript.

Thank you.
0
 
LVL 2

Expert Comment

by:netjkus
ID: 12126141
The session variable is accessible anywhere in the program.. But I dont quite clear why you dont see that. You dont need to use Javascript.. Do you need to display that value on tooltip or something?
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 2

Accepted Solution

by:
SimonTocker earned 500 total points
ID: 12130951
If your talking about accessing things on the client browser in the page when its already rendered, too late.  You need to understand the difference between server side and client side, all the c# code you have in your code behind once rendered is now not accessible to the client in the rendered page uless you spat it out to the client.

Like netjkus says, do you want a tooltip, thats one way to get that info without using Javascript use title="fred" in the label/panel.

Otherwise if you want something more complicated than that you are talking javascript, the onMouseOver event IS a client scripting event, your are using client side script from that point.  


BTW.   A panel, whilst being a handy place holder and all the vb guys are used to panels, renders different in non-ie browsers, it becomes a table, something you might not want.  Use a place holser and labels instead of panels if you dont want that unwated behaviour.



0
 
LVL 1

Author Comment

by:fpoyavo
ID: 12133153
Netjkus,

I just need to get session variable value on mouse over textbox.

Thank you.
0
 
LVL 3

Expert Comment

by:w_shaila
ID: 12138309
TextBox1.Attributes.Add("onmouseover","javascript:getSession('"+ Session["ID"].ToString() + "')");

getSession is a Javascript function

function getSession (id)
                  {
                        alert(id);
                  }

Like this you can get it
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 12143390
W_Shaila,

Yep. The only problem is that this Javascript has to be server side to get Session variables which does not work in C#. I was trying it along time ago.

Thanks anyway.
0
 
LVL 3

Expert Comment

by:w_shaila
ID: 12143757
The code which I posted is in C# only. it is working for me.
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 12162967
W_shaila,

In fact VS does not compile your code at all.

Thank you.

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question