change button type from "submit" to "button"

Discussion in 'ASP .Net' started by Tony WONG, Apr 22, 2010.

  1. Tony WONG

    Tony WONG Guest

    the button is created at runtime

    the button is used as "select all checkbox" in gridview by javascript

    Dim lc As New Button
    lc.Text = "Select All"
    lc.Attributes.Add("onclick", "SelectAll('" & GridViewID & "');")
    container.Controls.Add(lc)

    when the button is clicked, it run javascript "but then submit".

    how can i change the button type from "submit" to "button"

    so that it can only run the javascript.

    Thanks.

    tony
    Tony WONG, Apr 22, 2010
    #1
    1. Advertising

  2. On Apr 22, 6:22 am, "Tony WONG" <> wrote:
    > the button is created at runtime
    >
    > the button is used as "select all checkbox" in gridview by javascript
    >
    >     Dim lc As New Button
    >     lc.Text = "Select All"
    >     lc.Attributes.Add("onclick", "SelectAll('" & GridViewID & "');")
    >     container.Controls.Add(lc)
    >
    > when the button is clicked, it run javascript "but then submit".
    >
    > how can i change the button type from "submit" to "button"
    >
    > so that it can only run the javascript.
    >
    > Thanks.
    >
    > tony


    lc.Attributes.Add("onclick", "SelectAll('" & GridViewID & "');return
    false;")
    Alexey Smirnov, Apr 22, 2010
    #2
    1. Advertising

  3. Tony WONG

    Tony WONG Guest

    Thanks a lot.
    Tony WONG, Apr 22, 2010
    #3
    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. Mark
    Replies:
    1
    Views:
    1,659
  2. Ghafran Abbas
    Replies:
    0
    Views:
    4,177
    Ghafran Abbas
    Oct 12, 2004
  3. Replies:
    2
    Views:
    6,160
  4. Sam
    Replies:
    1
    Views:
    1,087
    Brian Kenneth Nielsen
    Nov 25, 2008
  5. babygodzilla
    Replies:
    4
    Views:
    105
    babygodzilla
    Sep 18, 2007
Loading...

Share This Page