Microsoft MVP Logo

[via Patrick]

If you’ve developed a moderately complex web part, you may have had to deal with the PostBack event.  It can be infuriating because SharePoint makes EXTENSIVE use of PostBacks.  Patrick Tisseghem ’s blog helps with this.

One thing to remember when working on a Web Part for SharePoint is that it is always a problem handling postbacks in a proper way. Your Web Part is probably not the only one on the page and therefore your check on IsPostBack() in the Page_Load event handler can often result in inappropriate behavior. Sometimes, when checking on the PostBack you want to make sure that it was a postback initiated by your Web Part. In one of the Web Parts we have created for a customer we use a toolbar to display some buttons to the user. When the user clicks on the button, we want to launch a specific action within the Web Part. In this case, if the user is an administrator, she can configure her own alerts or the alerts for the users having access to the site.

» Handling PostBacks in Web Parts

Comments powered by Disqus