views:

28

answers:

1

hi I have a Button in my .aspx web form and use c# 3.0 I want to add a javascript function to its attribute as its "onclick" event handler. the function has 1 parameter in order to check whether onclick javascript should get a confirmation from user or not. The parameter Datatype is bool But when I send true, execution of the program halts and show me a message that True is not defined!!

What's wrong?

A: 

True needs to be lowercase in javascript.

James Kolpack
so you say I should declare a string variable and make lowercase of the input parameter?
odiseh
Yes, I'm not sure what your objects look like exactly, but should be able to do it something like this:onclick="myJsFunction(<%=Datatype.ToString().ToLower(); %>); return false;"or perhaps just do some conditional logic on the bool:onclick="myJsFunction(<%=Datatype ? "true" : "false" %>); return false;"
James Kolpack