Does anyone know how can I passing value into the javascript function in asp:LinkButton OnClientClick?
Example:
If I have the following code:
<asp:ListView ID="lvTeams" runat="server" DataSourceID="dsTeams" DataKeyNames="ReferenceValue"
OnItemCommand="lvTeams_ItemCommand">
<LayoutTemplate>
<ul style="color:#fe8113;">
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<li>
<asp:LinkButton runat="server" OnClientClick="return multipleTeamsAllowedValidation()" CausesValidation="true" CommandName="" CssClass="orange"
Text='<%# Eval("TeamName")%>' />
</li>
</ItemTemplate>
</asp:ListView>
How can I pass the value <%# Eval("ReferenceValue")%> into the JavaScript function multipleTeamsAllowedValidation()in the asp:LinkButton OnClientClick event??
You can try
or
You can try out this.Value or this.InnerText to pass the value to html function
or
you can pass object itself by passing this
than you can able to access the text of it easily and than do the perform operation.
in function do
document.getElementById(this.Id).innerText or this.innerText