Friday, February 11, 2011

Adding server side and client side execution simultaneously to Asp.Net Buttons

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

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...