change button type from "submit" to "button"

  • Thread starter Thread starter Tony WONG
  • Start date Start date
T

Tony WONG

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
 
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;")
 
Back
Top