How to pass bind or eval arguments with the client function "OnClientClicking"

I am encountering an issue to pass arguments for the OnClientClicking client event.

I tried using the String.Format () function, but it does not work.

Do you have an idea of ​​a workaround to send a parameter related to OnClientClicking ?

asp code:

 <telerik:RadButton ID="bnt_meetingDelete" runat="server" OnClientClicking="<%# string.Format("confirmCallBackFn('{0}');",Eval("MeetingID")) %>" Image-ImageUrl="~/image/icone/delete-icon.png" Image-IsBackgroundImage="true" Width="21" Height="21" telerik:RadButton> 

IIS Error:

 Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: The server tag is not well formed. 

I tried with the controller [asp: ImageButton]. Same mistake

+4
source share
2 answers

Change the double quote to a single quote

OnClientClicking="<%#string.Format("confirmCallBackFn('{0}');",Eval("MeetingID")) %>"

to

OnClientClicking='<%#string.Format("confirmCallBackFn('{0}');",Eval("MeetingID")) %>'

Or delete your string.Format and use this as

 OnClientClicking='<%# "confirmCallBackFn("+ Eval("MeetingID") + ");" %>' 
+17
source

try OnClientClicking='<%# Eval("MeetingID", "confirmCallBackFn({0})") %>'

+1
source

Source: https://habr.com/ru/post/1490258/


All Articles