Tuesday, October 6, 2009

Raising Events From a User Control

Code behind of a user control:

public event System.EventHandler CertainEventOccured;

Fire it when this event occurs like follows;

if(this.CertainEventOccured != null){

        this.CertainEventOccured(this, new EventArgs());

}

Code behind of the page:

Wire up the the event like;

this.MyControl.CertainEventOccured += new EventHandler(MyControl_CertainEventOccured);

And finally define the function that will run when this event is fired.

private void MyControl_CertainEventOccured(object sender, EventArgs e) {

       //your logic goes here

}

Friday, June 19, 2009

JavaScript Best Practices

Very nice JavaScript article.

http://net.tutsplus.com/tutorials/javascript-ajax/24-javascript-best-practices-for-beginners/

Technorati Tags:

Tuesday, January 20, 2009