Tuesday, February 16, 2010

0214: SP Webparts

1. Create a rss webpart

public class RSSWebPart : WebPart

// This is where the HTML gets rendered to the
// web-part page.
protected override void RenderContents(HtmlTextWriter writer)
{

or

// when need to use other asp.net server  control like button textbox

protected override void CreateChildControls()
        {
            base.CreateChildControls();

 

SP Eventhanndler

 

In my mind, the concept of sp event just likes that of trigger in relational database.

1. when to use eventhandler/workflow?

In general, you will want to create an event handler rather than a workflow when you need to attach small bits of code that will run immediately before or after a list event has occurred.

2. SP 2007 exposes two points events

    • Synchronous : fired before events is processed by sharepoint
    • Asynchronous: fired after event is processed by shapepoint

3.  main event receivers:

  • List event receiver

      In respond to events that SharePoint
      lists fire

  • Item event receiver(SPitemeventreceiver)

      in response to events that a list item raises.

  • Web event receiver
    • in response to when a site fires a specified event.
  • Email event receiver
  • IListEventSink event receiver

4. Debug event handler or web part


Debugging event handlers is a lot like debugging web parts in that you can’t run them
directly. Rather, you must attach to the W3wp.exe process and step through the event
handler when the event is raised by SharePoint.

0 Comments:

Post a Comment

<< Home