0
<asp:TemplateField HeaderText="MRN Number" ItemStyle-Width="6%">
     <ItemTemplate>

          <asp:Label ID="lblMRNNumber" runat="server" Text='<%#Bind("MRNNumber") %>'
               onmouseover="tooltip.pop(this,' test');"></asp:Label>

      </ItemTemplate>
 </asp:TemplateField>

My javascript function

 tooltip.pop(this,'test')

working fine when mouse hover.
But I want like below.(Which means instead of 'test' , need to pass the MRNNumber

tooltip.pop(this,'<%#Bind("MRNNumber") %>') 

how to do this... is it possible.

7
  • Please post your html using browser's "view source" Commented Mar 5, 2014 at 6:16
  • the page has large so i put part of it, <td style="width:6%;"> <div class="textEllipsis"> <span id="ctl15_gvIndentSearch_ctl03_lblMRNNumber" onmouseover="tooltip.pop(this,Eval(&#39;MRNNumber&#39;));"></span> </div> </td> Commented Mar 5, 2014 at 6:19
  • What does #Bind(...) do? Commented Mar 5, 2014 at 6:20
  • Flix Kling, Bind is an example, I want to pass the MRNNumber value to tooltip.pop function's one of the argument. Commented Mar 5, 2014 at 6:31
  • I have a reference Link onmouseover='<%# String.Format("tooltip.pop(this,(\"{0}\")", Eval("MRNNumber"))%>' but it wont work I got error from IE status bar as Expected ')', Can any one modify for my requirement. Thanks. Commented Mar 5, 2014 at 7:02

1 Answer 1

1

Use string concatenation within the onmouseover attribute.

<asp:TemplateField HeaderText="MRN Number" ItemStyle-Width="6%">
 <ItemTemplate>

      <asp:Label ID="lblMRNNumber" runat="server" Text='<%#Bind("MRNNumber") %>'
         onmouseover='<%= "tooltip.pop(this,'" & Eval("MRNNumber") & "');" %>'></asp:Label>

  </ItemTemplate>
 </asp:TemplateField>
Sign up to request clarification or add additional context in comments.

3 Comments

I haven't tried that with onmouseover, though. traditional server control properties can be set this way.
I just added a space between the last double quote and the percent sign. See if that helps.
Error , Server tags cannot contain <% ... %> constructs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.