Monday, February 7, 2011

publicity event fire c#

publicity event fire

In Usercontrol

Declare this:

public event EventHandler FileUploaded;

In some of click event of usercontrol

// Fire public event.
FileUploaded(this.FileResourceId, e);

On .aspx page

On the page load

writes instance to know usercontrol first: uFileUploader =

if (uFileUploader != null)
uFileUploader.FileUploaded += new EventHandler(FileUploaded);

Then create event:

private void FileUploaded(object sender, EventArgs e)

// logic for page update.

No comments: