First, in my aspx code, I put in this piece of code for a div tag.
Next, I wrote the getPostBack piece of code.
protected string getPostBack()
return this.Page.GetPostBackEventReference(this, "@@@@@buttonPostBack"");
Next, we need to modify the Page_Load() code in order to determine when a postback occurred.
protected void Page_Load(object sender, System.EventArgs e)
// this Is a postback, then we care
if( this.IsPostBack )
// determine who caused the post back
string eventArg = Request[ "__EVENTARGUMENT" ];
// if null ( could it ever be null? )
if( eventArg != null )
// this post back can occur if we raise the event or if the Web Form itself raises the event.
// therefore, i always like to put something in the eventarg that lets me identify it as an event
// that i raised. i use @@@@@. but you can use whatever you like, just make sure it is unique.
// i also like to make the ClientId part of the value if i am posting back within a user control or
// custom control. including the ClientId in a user or custom control enables me to programmatically
// determine which instance of the control executed the postback. again we do this because all postbacks
// for all instances of all controls on the page are being funneled through this one method.
int offset = eventArg.IndexOf( "@@@@@" );
if( offset > -1 )
// this is an event that we raised. so do whatever you need to here.
Hope this helps someone out in VirtualWorld. As always, comments and feedback are appreciated.
Composed with Newz Crawler 1.4 http://www.newzcrawler.com/