Passing Eval from Aspx to JavaScript Function as Parameter

Passing Eval from ASPX to Javascript function as Parameter

Yes. What you want to do is this, though:

onclick='<%# "PopulateTicketDiv(" +Eval("SHOW_ID") + " );" %>'

How to Properly pass Eval to javascript function?

Finally pulled it off with the following:

 <asp:ImageButton runat="server" ID="addNote" ImageUrl="/ESDNET/Images/Icons/add.png" OnClientClick='<%# String.Format("return ShowNewNoteForm(\"{0}\")", Eval("SuggestionID")) %>'/>

Passing Eval parameter to a JavaScript function from ASPX file

Try this instead.

<asp:ImageButton ID="btnOK" OnClientClick='<%# Eval("Title", "Show({0});return false;") %>' runat="server" ImageUrl="Images/icon.gif" />

Pass Eval as javascript function parameter in gridview

Try this instead:

ASPX:

<asp:Button ID="wrqst_need_ind_btn" runat="server" Text="Create WR"
onClientClick="<%# GetPopupScript() %>" />

Code-behind:

protected string GetPopupScript()
{
return string.Format( "javascript:popUp('popup_createWR.aspx', '{0}', '{1}')", Eval( "dvc_nm" ), Eval( "data_orgtn_yr" ) );
}

Passing multiple Eval parameters to a JavaScript function from ASPX

Suppose functions is...

<script language = 'javascript'>
function confirm_ticket(ID, ID1)
{

}
</script>

OnClientClick='<%# String.Format("confirm_ticket({0},{1});
return false;",Eval("idAgir"), Eval("idAgir"))%> '

Alternatively you can move in ItemBoundData and there also the string can be concatenated.

How to pass evaluated Eval in javascript function

Just get rid of IIf, you do not seem to need it. I also recommend output the whole function call with C# code, makes it easier on quotes. So (formatted for better readability):

onclick='<%#
"ShowViewPopup(this, \"detail\", null, null, "
+ String.IsNullOrEmpty(Eval("CustomerNumber"))
+ ")"
%>'


Related Topics



Leave a reply



Submit