Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

Exit server side script on ASP page

I need to validate that there are records returned.  If not I need to exit the sever side script and display an alert box on the aspx.net page.   How can I do this please.  I do not want to use response.write I need the user to be alerted to the fact that there is no info for them.

Thanks

If objRdr.Read() Then
       Response.Write(objRdr(0))
    Else
       response.Write("NO RECORDS RETURNED")
    End If  
0
running32
Asked:
running32
  • 3
  • 2
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
Try:

    If objRdr.Read() Then
       Response.Write(objRdr(0))
       Response.Write("<script language=""javascript"">alert('NO RECORDS RETURNED');</script>"
       Response.Flush()
    Else
       response.Write("NO RECORDS RETURNED")
    End If  
0
 
running32Author Commented:
Nope that's not it.  The page give the error no End if.  
0
 
Carl TawnSystems and Integration DeveloperCommented:
Does it say where ? It shouldn't be for that block.
0
 
running32Author Commented:
If I take out the Response.Write("<script language=""javascript"">alert('NO RECORDS RETURNED');</script>" the page is ok again.

Thanks
0
 
Carl TawnSystems and Integration DeveloperCommented:
Oh, its missing the closing bracket:

     Response.Write("<script language=""javascript"">alert('NO RECORDS RETURNED');</script>")
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now