Results 1 to 10 of 10

Thread: Newbie - how to create client side's message box

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Newbie - how to create client side's message box

    Dear all,

    I am very new with ASP.NET .. how to create client side's message box? .. please help

    TIA

    Regards
    Winanjaya

  2. #2
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    use javascript. basically, use an alert function within the body of the page itself.
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Code:
    <script language="JavaScript">
    alert('Hello Cruel World!');
    </script>
    Of course, there are many places you'd use it. Like the onClick event of a button, or page load event, etc.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784
    So there is no ASP.NET code for doing this? ..
    please advise

    Regards
    Winanjaya

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    It depends. Where and when do you want this shown?

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784
    I want to show it at client side.. any idea?

    thanks

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    VB Code:
    1. Button1.Attributes.Add("onClick", "javascript:alert('Hello');")


    Or make it a call to an existing function.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784
    Where should I put them? .. in Page_load or what? .. please advise .. sorry I am very new with this..
    thanks a lot in advance

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Sure, put it in page load. That vb.net code above adds this:

    <input type="button" value="Click me!" onClick="javascript:alert('hello');>

  10. #10
    New Member
    Join Date
    Dec 2004
    Posts
    8

    Re: Newbie - how to create client side's message box

    hi,
    you could do a little futher on that, you could do it in an event doing something like this
    dim sScript as string="<script language=javascript>"
    sScript +="alert(""" your message variable or otherwise """");"
    sScript +="</script>"
    If not Page.IsStartupScriptRegistered("nameofyourscript") then
    page.registerstartupscript("nameofyourscript",sScript)
    end if
    end sub
    Just be aware that when you try to find the isstartupscriptregistered and the registerstartupscript with the inteligicence you wouldn't find then so you have to type them all

    Hope this helps a little bit more

    Ben

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