Arthur
February 23rd, 2005, 10:24 AM
Hello,
I have an ASP button (rendered as <input type=submit>), and when I click it, it does a postback to the server.
I would like to do some client side stuff, which I dynamically create and put in "Attributes". I don't want to the button to do a postback when clicked.
To avoid a postback I tried an HtmlButton instead like this:
<BUTTON id="myButton" value="ClickMe"></BUTTON>
In ASP:
Declared a HmlButton myButton and in a postback event handler I want to fill the button like this
myButton.Attributes.Add("onclick", "DoMyDynamicallyFormattedStuff");
However I get a nullrefrenceException on myButton.
Does anyone how I can create a button, with dynamically added attributes that does not perform a postback?
Arthur
I have an ASP button (rendered as <input type=submit>), and when I click it, it does a postback to the server.
I would like to do some client side stuff, which I dynamically create and put in "Attributes". I don't want to the button to do a postback when clicked.
To avoid a postback I tried an HtmlButton instead like this:
<BUTTON id="myButton" value="ClickMe"></BUTTON>
In ASP:
Declared a HmlButton myButton and in a postback event handler I want to fill the button like this
myButton.Attributes.Add("onclick", "DoMyDynamicallyFormattedStuff");
However I get a nullrefrenceException on myButton.
Does anyone how I can create a button, with dynamically added attributes that does not perform a postback?
Arthur