I have the following image button inside a gridview:
<asp:TemplateField HeaderText="Edit" ControlStyle-CssClass="smallTxt"
HeaderStyle-CssClass="smallTxt">
<ItemTemplate>
<asp:ImageButton runat="server" ImageUrl="../images/yellow_arrow.gif" ID="imgbtnsearch"
OnClientClick="javascript:setCustID('<% Eval(idCustomer)%>');return false;" />
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
Using this image button triggers a JavaScript function. The function is as follows:
function setCustID(cid) {
alert(cid);
ShowHideControl('ctl04_divEdit');
document.getElementById('ctl04_hdnIdCustomer').value = cid;
}
However, when I run this code, instead of receiving the result of Eval(idCustomer)
as a number in the alert box, I get:
<% Eval(idCustomer).toString()%>
When I attempt to pass the parameter using <%#Eval(idCustomer)%>
OnClientClick="javascript:setCustID('<%#Eval(idCustomer)%>');return false;"
The function alerts:
<%#Eval(idCustomer)%>