I'm trying to call a javascript function.
function callSubClass(SubClassName) {
...
}
But I am trying to call it inside a repeater where the parameter "SubClassName" is a string bound to my repeater.
<asp:Repeater ID="rptSubClass" runat="server">
<ItemTemplate>
<asp:LinkButton Text='<%# Eval("SubClassName") %>' runat="server" ID="linkHomeItem" OnClick='<%# callSubClass(Eval("SubClassName")); return false; %>'/>
<br />
</ItemTemplate>
</asp:Repeater>
But every time I run it I get a compiler error saying:
CS1040: Preprocessor directives must appear as the first non-whitespace character on a line Error
Now I know the error is on the OnClick='stuff' but I've tried all I could think of to make it work. Here's a list of what I tried so far.
OnClick='<%# callSubClass(Eval("SubClassName")); return false; %>'
OnClick='callSubClass(<%# Eval("SubClassName") %>); return false;'
OnClick='"callSubClass("+<%# Eval("SubClassName") %>+"); return false;"'
What am I doing wrong? Thanks for any help provided.