Solved

javascript title property for tooltip

Posted on 2011-09-12
4
245 Views
Last Modified: 2012-05-12
Hi,

In a javascript function I am trying to set a tooltip, via the title attribute (see below)

  var fzip = document.getElementById('txtforeign');
  fzip.title = 'Foreign'

the txtforeign textbox is defined in my aspx as the following:
<asp:textbox ID="txtforeign" style="Z-INDEX: 139; LEFT: 502px; POSITION: absolute; TOP: 97px" MaxLength="10" Width="75" Visible="true" runat="server"></asp:TextBox>

my problem is in the codebehind in vb.net on a btnsubmit click event, I want to try to access the tooltip property for the textbox txtforeign that I just set in javascript but it is coming back a "" in the codebehind even though it will show 'Foreign' on the mouseover when I have the page up and I can't figure out for the life of me what I am doing wrong here.

Thanks


0
Comment
Question by:UFCWIT
  • 2
4 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 36523556
CodeBehind on Server does not see what the browser script has done.
The new set attributes are only present in browser and NOT on server side.

0
 

Author Comment

by:UFCWIT
ID: 36523595
Thanks Zvonko,

Is there anyway properties that I can share between client and server, I need to be able to access a property that I can set between client and server to determine something on the button submit.

0
 
LVL 82

Expert Comment

by:leakim971
ID: 36523610
save the title in a hidden field :

<asp:Hidden ID="txtforeign_tooltip_value" runat="server"></asp:Hidden>

var fzip = document.getElementById('txtforeign');
fzip.title = 'Foreign';
document.getElement("<%= txtforeign_tooltip_value.ClientID %>").value = 'Foreign';
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 36523680
The answer is: No, you cannot send attributes on Submit.
You can only send form field values, URL parameters and Cookies to server.
The best choice is always to send the required attributes in form fields as in upper example.
You can do the hidden field store at attribute set time or at on form submit time you can refresh the hidden fields with current attribute values.
For example if you want to store the window scroll position then you have to fetch and send it somehow to server to adjust it again at next page display time.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

756 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