Sending Client Side Event ?

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Re: Sending Client Side Event ?

    "Genival" <geniobr@hotmail.com> wrote in message
    news:e1x0bIOdDHA.2804@TK2MSFTNGP11.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.saunders@surfcontrol.com[/email]


    John Saunders Guest

  2. Similar Questions and Discussions

    1. Stopping client side event validation
      Hi all, I've been trying unsuccessfully to stop client side event validation. I've created a simple page with a text box, a required field...
    2. Client side event for datagrid control
      This is probably a simple one, but I cannot seem to find an example. I have a datagrid with each row containing Checkbox | Textbox |...
    3. client side event for grid
      This is probably a simple one, but I cannot seem to find an example. I have a datagrid with each row containing Checkbox | Textbox |...
    4. client side checkbox event
      This is probably a simple one, but I cannot seem to find an example. I have a datagrid with each row containing Checkbox | Textbox |...
    5. running client side script after an <asp:ButtonColumn> click event
      "z. f." wrote Get a reference to the delete button in the ItemCreated event of your datagrid, then use: btnDelete.Attributes.Add("onclick",...
  3. #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.saunders@surfcontrol.com> escreveu na mensagem
    news:OL$RpqYdDHA.828@TK2MSFTNGP11.phx.gbl...
    > "Genival" <geniobr@hotmail.com> wrote in message
    > news:e1x0bIOdDHA.2804@TK2MSFTNGP11.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.saunders@surfcontrol.com[/email]
    >
    >

    Genival Guest

  4. #3

    Default Re: Sending Client Side Event ?

    "Genival" <geniobr@hotmail.com> wrote in message
    news:Oqa0tOZdDHA.3464@TK2MSFTNGP11.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

Posting Permissions

  • You may not post new threads
  • You may 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