javascript title property for tooltip

Posted on 2011-09-12
Medium Priority
Last Modified: 2012-05-12

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.


Question by:UFCWIT
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 63

Expert Comment

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.


Author Comment

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.

LVL 82

Expert Comment

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';
LVL 63

Accepted Solution

Zvonko earned 2000 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.


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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 …
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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…

719 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