Reputation: 1180
I am trying to pass a parameter to my jquery function through the onclick event of a textbox. This is the code:
HTML Code:
<asp:TextBox ID="txtLoginName" OnClick='timepass(<%# Eval("userid")%>);' Text='<%# Eval("LoginName")%>'
runat="server"></asp:TextBox>
and my jquery function:
<script type="text/javascript">
function timepass(pass) {
alert(pass);
}
but nothing happens. When I pass like this on onclick event OnClick="timepass(123)"
it works fine.
What am I doing wrong?
Upvotes: 0
Views: 1235
Reputation: 2898
You can pass the value like:
onclick='<%# "timepass(" + Eval("LoginName") + ");" %>'
<script type="text/javascript">
function timepass(pass) {
alert(pass);
}
Upvotes: 1