Friday, July 24, 2009

Javascript function with parameters call onclientclick

To call a javascript function and pass parameters on client click of any button , link button etc. use following syntax:

OnClientClick='<%
"ShowBookingDialog(\""+Eval("CreditCard")+"\",\""+Eval("NonSmoking")+"\",\""+Eval("CreditCardType")+"\",\""+Eval("CreditCardExpiration")+"\",\""+Eval("SrNo")+"\")"
%>
Here my button or link button is in datalist or gridview and i set its datsource.
And "ShowBookingDialog" is a javscript function and passing parameters to it onClientClick.

No comments:

Post a Comment