Q: How to call html button onclick javascript function with aspx parameter? I need to pass parameters from repeater to javascript function. But I can't do it like this:
     onclick="myFunction(<%# ((myObject)Container.DataItem).myValue) %>)" 

It says syntax error.
I need to call myFunction(myValue) javascript function. 
And the myValue have to come from 
     <%# ((myObject)Container.DataItem).myValue) %>

What is the correct way to do this ?

A: If you want to write all of it in the markup (and not in rowdatabound or somewhere in code behind) you can use this syntax:
onclick = '<%# "myFunction(" + Container.DataItemIndex + ")" %>'


A: What you need to do is add a couple of quotes:
onclick="myFunction("<%# ((myObject)Container.DataItem).myValue %>")"
This should work with what you are trying to achieve.

A: Try this if you pass string
onclick='<%# string.Format("myFunction(\"{0}\")",((myObject)Container.DataItem).myValue)%>'

otherwise use following...
onclick='<%# string.Format("myFunction({0})",((myObject)Container.DataItem).myValue)%>'


A: Try adding the onclick from Server Side,
Control.Attributes.Add("onclick",((myObject)Container.DataItem).myValue)


A: Use something like this.Modify this according to your requirement. 
protected void Gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
 {

var jsFunction = String.Format("Javascriptfunctionname('{0}','{1}');", parameter1, parameter2);
Gridcontrol.Attributes.Add("onclick", jsFunction);

}

Hope this will help you.

A: try the following code.
onclick="javascript:myFunction("<%=((myObject)Container.DataItem).myValue) %>")";


A: You should use the = instead of #
onclick = "myFunction(<%= ( (myObject)Container.DataItem).myValue ) %>)"
