Results 1 to 4 of 4

Thread: java alert

  1. #1

    Thread Starter
    Hyperactive Member r0k3t's Avatar
    Join Date
    Dec 2005
    Location
    Cleveland
    Posts
    361

    java alert

    This can't be that hard but I can't seem to find a way to do it... I have googled several different ideas to no avail. this is what I need to do.

    I have an ASP.NET Page with a button - Of course the code behind is C#. When the user clicks the button I want check if there are any selected items (that is no problem) if there aren't any selected items I need to pop up and alert - that tells them this...

    Can someone point me in the right direction on this? I would think it would be simple but I can't find anything that shows how to conditionally call a java alert - or some sort of alert...

    Thanks!!!

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: java alert

    You can't pop-up a client-side alert from the server. You'll either need to write the JavaScript yourself so it'll pop-up on the client side (post-backs to check if items are selected is a waste of time anyway) or you can use the ASP.Net Ajax components to get the job done as per: http://forums.asp.net/p/1055457/1502283.aspx#1502283
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: java alert

    You can always use
    Code:
    Response.Write("<script>alert(\"Error\");</script>");
    But I wouldn't recommend that
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: java alert

    Use Page.RegisterStartupScript or ClientScript.RegisterStartupScript to pass your <script> and alert() through, ComputerJy wouldn't use Response.Write because it's bad practice (writing to the output stream...er... mid stream).

    Also, it's javascript, not java, big difference.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width