asp panel

Hi Experts,

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

Thank you.
LVL 1
fpoyavoAsked:
Who is Participating?
 
SimonTockerCommented:
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
 
netjkusCommented:
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
 
fpoyavoAuthor Commented:
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
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
netjkusCommented:
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
 
fpoyavoAuthor Commented:
Netjkus,

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

Thank you.
0
 
w_shailaCommented:
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
 
fpoyavoAuthor Commented:
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
 
w_shailaCommented:
The code which I posted is in C# only. it is working for me.
0
 
fpoyavoAuthor Commented:
W_shaila,

In fact VS does not compile your code at all.

Thank you.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.