• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 660
  • Last Modified:

asp panel

Hi Experts,

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

Thank you.
0
fpoyavo
Asked:
fpoyavo
  • 4
  • 2
  • 2
  • +1
1 Solution
 
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
 
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now