Mostly we want server side code to work when we click on a button. However there are times that we want both server side and client side code to be running for a button. You can get this achieved by using buttons attribute method. I have given below a small sample of getting this done.
You need to specify the event that you want to fire following a comma and then give the javascript method that should be executed.
this.btnSave.Attributes.Add("onclick", "javascript:ShowMessage();" + ClientScript.GetPostBackEventReference(this.btnSave, ""));
No comments:
Post a Comment