I'm trying to get a button to fire off both client-side javascript
and some server-side code, but I can only get it to do one or the
other. If I set both up, only the client-side event-handler will
fire. I've played with using different events (e.g. onmousedown for
the client-side event and onclick for the server-side event), but it
doesn't seem to make any difference.
I've read lots of articles telling me I can do this, but they only
contain examples of one or the other. What am I missing here?
ASPX File
...
<script language="javascript">
function ClientClick() {
alert("this is client code.");
}
...
ASPX.CS File
MyButton_Load(...) {
MyButton.Attributes["onclick"] = "ClientClick();";
}
MyButton_Click(...) {
// server side code goes here.
}