Professional Web Applications Themes

Sending Client Side Event ? - ASP.NET Building Controls

"Genival" <geniobrhotmail.com> wrote in message news:e1x0bIOdDHA.2804TK2MSFTNGP11.phx.gbl... > Hello Folks... > From my control i need notify client side script about some events occurs. > Any idea ? You can't quite do this. The only thing your control can do is to send data (usually HTML) to the client. Now, you may be able to send some HTML to the client which will cause some client script to execute. For instance, you could have a control called Alarm which would take its "Text" property and render script as follows: protected override void OnPreRender(EventArgs e) { const scriptStart = "<script language=JavaScript>alert('"; const ...

  1. #1

    Default Re: Sending Client Side Event ?

    "Genival" <geniobrhotmail.com> wrote in message
    news:e1x0bIOdDHA.2804TK2MSFTNGP11.phx.gbl...
    > Hello Folks...
    > From my control i need notify client side script about some events occurs.
    > Any idea ?
    You can't quite do this. The only thing your control can do is to send data
    (usually HTML) to the client.

    Now, you may be able to send some HTML to the client which will cause some
    client script to execute. For instance, you could have a control called
    Alarm which would take its "Text" property and render script as follows:

    protected override void OnPreRender(EventArgs e)
    {
    const scriptStart = "<script language=JavaScript>alert('";
    const scriptEnd = "');</script>";

    this.Page.RegisterStartupScript(this.UniqueID, scriptStart + this.Text +
    scriptEnd);
    }

    This script would execute once the page was loaded, because it will be
    emitted right before the closing </form> tag. You can also emit script right
    after the opening <form> tag with Page.RegisterClientScriptBlock.
    --
    John Saunders
    Internet Engineer
    [email]john.saunderssurfcontrol.com[/email]


    John Saunders Guest

  2. #2

    Default Re: Sending Client Side Event ?

    Thank John..
    Another question : Is possible to put my script inside <HEAD>...</HEAD>
    block ?

    Regards
    Genival Carvalho.

    "John Saunders" <john.saunderssurfcontrol.com> escreveu na mensagem
    news:OL$RpqYdDHA.828TK2MSFTNGP11.phx.gbl...
    > "Genival" <geniobrhotmail.com> wrote in message
    > news:e1x0bIOdDHA.2804TK2MSFTNGP11.phx.gbl...
    > > Hello Folks...
    > > From my control i need notify client side script about some events
    occurs.
    > > Any idea ?
    >
    > You can't quite do this. The only thing your control can do is to send
    data
    > (usually HTML) to the client.
    >
    > Now, you may be able to send some HTML to the client which will cause some
    > client script to execute. For instance, you could have a control called
    > Alarm which would take its "Text" property and render script as follows:
    >
    > protected override void OnPreRender(EventArgs e)
    > {
    > const scriptStart = "<script language=JavaScript>alert('";
    > const scriptEnd = "');</script>";
    >
    > this.Page.RegisterStartupScript(this.UniqueID, scriptStart + this.Text
    +
    > scriptEnd);
    > }
    >
    > This script would execute once the page was loaded, because it will be
    > emitted right before the closing </form> tag. You can also emit script
    right
    > after the opening <form> tag with Page.RegisterClientScriptBlock.
    > --
    > John Saunders
    > Internet Engineer
    > [email]john.saunderssurfcontrol.com[/email]
    >
    >

    Genival Guest

  3. #3

    Default Re: Sending Client Side Event ?

    "Genival" <geniobrhotmail.com> wrote in message
    news:Oqa0tOZdDHA.3464TK2MSFTNGP11.phx.gbl...
    > Thank John..
    > Another question : Is possible to put my script inside <HEAD>...</HEAD>
    > block ?
    Though it may be possible, why would you do it?

    --
    -Jimmy
    Used-Disks:
    [url]http://www.used-disks.com/[/url]


    Jimmy [Used-Disks] Guest

Similar Threads

  1. Stopping client side event validation
    By paul.hester@gmail.com in forum ASP.NET Building Controls
    Replies: 0
    Last Post: September 11th, 05:10 AM
  2. Client side event for datagrid control
    By Xavier Pacheco in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: July 29th, 09:58 PM
  3. client side event for grid
    By Xavier Pacheco in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: July 28th, 03:10 PM
  4. client side checkbox event
    By Xavier Pacheco in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: July 27th, 04:25 AM
  5. Replies: 1
    Last Post: July 24th, 08:44 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139