2

I'm trying to concatenate an Eval data to an OnClientClick function. What I did is this:

<asp:LinkButton id="Activate" runat="server" OnClientClick='return confirmActivate(<%# Eval("nameID")%>);'>Activate</asp:LinkButton>

But it shows the code of Eval inside when I inspect it's element. How could I put nameID's data inside the OnClientClick function??

marchemike
  • 3,179
  • 13
  • 53
  • 96

1 Answers1

2

You can use Eval with format.

<asp:LinkButton ID="Activate" runat="server"
    OnClientClick='<%# Eval("nameID", "return confirmActivate(\"{0}\")") %>'>
    Activate
</asp:LinkButton>
Win
  • 61,100
  • 13
  • 102
  • 181