Too many characters in a literal letter?

Can you please tell me what is wrong with this code ??? About going crazy !!!

<asp:LinkButton ID="LinkButton1" OnClick="DivAc('griddiv')" Font-Size="Smaller"  runat="server" CommandName='<%# Eval("harf").ToString().ToUpper()%>'><%# Eval("harf").ToString().ToUpper() %></asp:LinkButton>

Error: Too many characters in a character literal ... :(

+5
source share
3 answers

Is DivAc('griddiv')javascript function? Then you should use OnClientClickinstead OnClick.

OnClickreserved for .NET functions. With the help of OnClientClickyou generate the OnClick attribute in HTML.

Perhaps this is a bit confusing.

So here is what you need to do:

<asp:LinkButton ID="LinkButton1" OnClientClick="DivAc('griddiv')" Font-Size="Smaller"  runat="server" CommandName='<%# Eval("harf").ToString().ToUpper()%>'><%# Eval("harf").ToString().ToUpper() %></asp:LinkButton>
+16
source

, (griddiv) ( , #, ). - OnClick="DivAc(\"griddiv\")"

OnClick - , , (, EventArgs) void. .

DivAc? JavaScript? , OnClientClick, , .

+13

I think your error is here:

CommandName='<%# Eval("harf").ToString().ToUpper()%>'><%# Eval("harf").ToString().ToUpper() %></asp:LinkButton>

I think it should be:

CommandName='<%# Eval("harf").ToString().ToUpper()%'></asp:LinkButton>
0
source

All Articles