Change js Tooltip
-
Hi, I am developing a web app using C# and asp.net. I am trying to incorporate the tooltips available here http://walterzorn.com/tooltip/tooltip\_e.htm#browser into my project, specifically the ability to display an image when the user scrolls over an icon. It is easy to hardcode an image to display but I need to be able to change the image displayed by the icon, this is the code needed to display an image onmouseover="Tip('Text with
image.')" So im just wondering if anyone has any ideas or suggestions….. Thanks in advance Tim
-
Hi, I am developing a web app using C# and asp.net. I am trying to incorporate the tooltips available here http://walterzorn.com/tooltip/tooltip\_e.htm#browser into my project, specifically the ability to display an image when the user scrolls over an icon. It is easy to hardcode an image to display but I need to be able to change the image displayed by the icon, this is the code needed to display an image onmouseover="Tip('Text with
image.')" So im just wondering if anyone has any ideas or suggestions….. Thanks in advance Tim
-
As the Javascript is in an argument in an html element, you have to html-encode the script:
onmouseover="Tip('Text with <img src="pics/image.jpg" width="60">image.')"
--- single minded; short sighted; long gone;
-
thanks for the reply but do you know if it is possible to change the text in onmouseover="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" an example would be different users loggin on to the same page and viewing a pic specific to them in the tooltip
-
Yes. Use the Attributes collection of the control. Example:
SomeControl.Attributes["onmouseover"] = Server.HtmlEncode(@"Tip('Text with <img src=""pics/image.jpg"" width=""60"">image.');");
--- single minded; short sighted; long gone;
oh ok nice one this is what i need thanks a lot but one last question i am just trying to test the different images on the tooltip but when i try and enter the text needed into a text box and update from there i get the following error A potentially dangerous Request.Form value was detected from the client (_ctl0:tbPic="Tip('
.)') Thanks again Tim
-
oh ok nice one this is what i need thanks a lot but one last question i am just trying to test the different images on the tooltip but when i try and enter the text needed into a text box and update from there i get the following error A potentially dangerous Request.Form value was detected from the client (_ctl0:tbPic="Tip('
.)') Thanks again Tim
It's the request validation that throws the exception. It filters out requests that contain special character combinations. In this case it's probably the < > characters that are stopped. You can turn off the request validation by using ValidateRequest="false" in the @Page directive.
--- single minded; short sighted; long gone;