Home All Groups Group Topic Archive Search About

OnClick - Method With Databind

Author
31 Oct 2007 6:29 PM
Jl_G_0
Hey all. hope someone can give me a little advice here.
I have a GridView, and on each line of it there's an
<asp:imagebutton> like this:

<asp:ImageButton ID="hlCancel" runat="server" ImageUrl="/details.png"
Width="10px" Height="10px" OnClick=<%#
showDetails(HttpUtility.HtmlEncode(Convert.ToString(Eval("id")))) %> /
>

The thing is, I need the OnClick event on each line to call the
method showDetails with the ID related to it, like showDetails(LINE
ID), but this binding tag, while working normally on normal fields
(Label's TEXT) doesn't work here.
I think the error is CASTING related... but Im not sure. I also tried
to create a function to return the string "showDetails(id)", but it
gives me an InvalidPostback error...

Anyone have a tutorial or lessons on binding with functions/methods ?

AddThis Social Bookmark Button