Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   passing parameter to javascript function (http://www.velocityreviews.com/forums/t72209-passing-parameter-to-javascript-function.html)

alf 02-04-2004 03:02 AM

passing parameter to javascript function
 
Hi, how can I pass a value from ASP.NET to a javascript function in the
client-side ?? my problem is appening the ' at beginin and end of the
argument:
href=<%# "javascript:myFunction(" +
HttpUtility.UrlEncode(DataBinder.Eval(Container.Da taItem,"id").ToString()) +
")" %>

the previous line will generate:
href=javascrip:myFunction(25)

but the real call to a function should be:
href=javascrip:myFunction('25')

and every time that I try to concat + "'" + in the asp.net code I get an
error saying that the instruction is not well formed..

thanks for any help



alf 02-04-2004 03:08 AM

Re: passing parameter to javascript function
 
sorry I got it !!!

using \" will generate the ".
thanks any way.

"alf" <alfredo@NOSPAMcubaautrement.com> wrote in message
news:%23jpynts6DHA.2496@TK2MSFTNGP09.phx.gbl...
> Hi, how can I pass a value from ASP.NET to a javascript function in the
> client-side ?? my problem is appening the ' at beginin and end of the
> argument:
> href=<%# "javascript:myFunction(" +
> HttpUtility.UrlEncode(DataBinder.Eval(Container.Da taItem,"id").ToString())

+
> ")" %>
>
> the previous line will generate:
> href=javascrip:myFunction(25)
>
> but the real call to a function should be:
> href=javascrip:myFunction('25')
>
> and every time that I try to concat + "'" + in the asp.net code I get an
> error saying that the instruction is not well formed..
>
> thanks for any help
>
>




azoozey 04-01-2011 10:32 AM

passing c# parameter in JavaScript
 
Dears,
I tried to pass a c# parameter in JavaScript but I got an error.

Line Code:
onclientclick="expand_shrink(<%# Eval("ID") %>)"


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: Server tags cannot contain <% ... %> constructs.


All times are GMT. The time now is 02:17 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.