In aspx page:
if (<%= Not Me.ThisVi开发者_开发问答sa.PassportExpirationDate.IsNull %>){
Returns error:
Microsoft JScript runtime error: 'True' is undefined
I tried this:
if ("<%= Me.ThisVisa.PassportExpirationDate.IsNull.ToString %>" != "True"){
..but I get a compile time error:
Error 5 Option Strict On disallows implicit conversions from 'String' to 'Long'
Help!
Consider moving the logic into the server script. Doing so will reduce how much JavaScript you emit onto the page.
<% If Not Me.ThisVisa.PassportExpirationDate.IsNull Then %>
// JavaScript Goodness
<% End If %>
What about:
if (<%= (Not Me.ThisVisa.PassportExpirationDate.IsNull).ToString().ToLower() %>){
This will evaluate the Boolean condition and convert it to a string, but you should lower-case it so it looks like JavaScript syntax when it's rendered.
Get rid of the extra spaces. Change to:
if ("<%=Me.ThisVisa.PassportExpirationDate.IsNull.ToString%>" != "True"){
You are missing the parenthesis for the ToString()
method.
update: sry, my bad
精彩评论