Trying to get an asp:Checkbox to display an alert when the person clicks it.

Discussion in 'ASP .Net Web Controls' started by Mufasa, Jul 25, 2007.

  1. Mufasa

    Mufasa Guest

    I have a situation where I need to display an alert when somebody clicks a
    check box. I was able to get it to work with a plain <input> but when I try
    and do it with an <asp:CheckBox> I can't get the javascript right.

    Anybody have any thoughts?

    TIA - Jeff.
     
    Mufasa, Jul 25, 2007
    #1
    1. Advertising

  2. Mufasa

    marss Guest

    On 25 , 22:38, "Mufasa" <> wrote:
    > I have a situation where I need to display an alert when somebody clicks a
    > check box. I was able to get it to work with a plain <input> but when I try
    > and do it with an <asp:CheckBox> I can't get the javascript right.
    >
    > Anybody have any thoughts?
    >
    > TIA - Jeff.


    <asp:CheckBox ID="CheckBox1" runat="server" ....

    Code behind:
    protected void Page_Load(object sender, EventArgs e)
    {
    ...
    CheckBox1.Attributes.Add("onclick", "alert('clicked');");

    Regards,
    Mykola
     
    marss, Jul 26, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mersh
    Replies:
    0
    Views:
    526
    Mersh
    Mar 13, 2007
  2. Ganesh
    Replies:
    0
    Views:
    585
    Ganesh
    Jun 29, 2007
  3. PontiMax

    Clicks and double-clicks

    PontiMax, Jul 14, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    210
    Eliyahu Goldin
    Jul 14, 2004
  4. Cheryl Cepak
    Replies:
    2
    Views:
    102
    David Rio Deiros
    Dec 2, 2008
  5. Josh

    capture checkbox clicks at server

    Josh, Apr 7, 2005, in forum: Javascript
    Replies:
    6
    Views:
    128
    Dr John Stockton
    Apr 13, 2005
Loading...

Share This Page