简体   繁体   English

使用bind()传递JavaScript参数

[英]Passing javascript argument using bind()

<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 我的JavaScript函数

 tooltip.pop(this,'test')

working fine when mouse hover. 鼠标悬停时工作正常。
But I want like below.(Which means instead of 'test' , need to pass the MRNNumber 但是我想像下面一样。(这意味着不是'test',而是需要传递MRNNumber

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

how to do this... is it possible. 怎么做...可能吗。

Use string concatenation within the onmouseover attribute. 在onmouseover属性内使用字符串连接。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM