dynamic - How can I set a Button's type to "Button" (as opposed to the default "Submit") in C#? -
according answer here, can prevent button submitting form setting type value "button", in html:
<button type="button">cancel changes</button>
...but how can in c#? creating controls dynamically, (pseudocode, i'm away ide):
button btn = new button { css = "bla" } btn.type = "button"; // <- this?
use htmlbutton instead of button if want "html button tag"
var btn = new htmlbutton(); btn.attributes["class"] = "bla"; btn.attributes["type"] = "button";
button renders <input type="submit" />
, button.usesubmitbehavior renders <input type="button" />
.
htmlbutton render <button type="your_definition"></button>
.
Comments
Post a Comment