2014-01-17 29 views
0

我想調用一個JavaScript函數的單個參數從GridView控件內部的鏈接單擊我需要提供的參數值<%Eval("myfield")%>我該怎麼做?從GridView以<% Eval("")%>作爲函數參數調用java腳本函數?

<ItemTemplate>         
    <a href="#" onclick='"javascript:return changeview(<%Eval("Id")%>)"'> 
      <asp:Label style="color:white;" ID="Label1" BackColor='<%# System.Drawing.Color.FromName(Eval("color").ToString())%>' runat="server" Text='<% #Bind("doctorname") %>'> 
      </asp:Label> 
    </a>         
</ItemTemplate> 

回答

0
OnClientClick='<%# String.Format("javascript:return changeview(\"{0}\")", Eval("Id").ToString()) %>' 
+0

i've嘗試過,但該功能不會甚至稱... –

0

你可以這樣做。

<a href="lnkTest" id="lnkViewContent" onclick="ShowContent('<%# Eval("Id") %>')">View Content</a>