kamagra how much to take

Developing A SharePoint Form WebPart – Part 1 – Set Up the WebPart Class

Before accomplishing any custom development, the necessary foundational code must be added to the WebPart in order to set it up for inclusion in the SharePoint environment. You must establish the following references (shown in the code listing) in the main WebPartclass file. Doing so allows WebPart class derivation out of the WebPart base class, procures SQL connectivity using ADO.NET 2.0, allows for definition of WebPart attributes, and tolerates the binding of the appropriate user interface controls for final output by an overridden RenderWebPart method.

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Text;
  5. using System.IO;
  6. using System.Web;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using Microsoft.SharePoint.WebPartPages;
  10. using System.Xml.Serialization;
  11. using System.Xml;
  12. using System.Web.UI.HtmlControls;
  13. using System.Data;
  14. using System.Data.SqlClient;
  15. using Microsoft.SharePoint;
  16. using Microsoft.SharePoint.Utilities;
  17. using Microsoft.SharePoint.WebControls;
  18. using System.Collections;

Supply the appropriate WebPart base class inheritance derivation for the parent class either through System.Web.UI.WebControls.WebParts or Microsoft.SharePoint.WebPartPages. For the Form WebPart, it is advisable to use the new ASP.NET 2.0 base class derivation, therefore set the inheritance to System.Web.UI.WebControls.WebParts.WebPart. Once the class has been defined, call the relevant XML decoration attributes in the XmlRoot element provided by the System.Xml.Serialization namespace by defining a default XML namespace in order to control the serialization of the WebPart properties.

Optionally, define the ToolBoxData attribute with the default Typename so that the control class is concretely defined when using it within an IDE. After modifications, your top level class definition should look like the following:

    [DefaultProperty(“Text”)]
    [ToolboxData(“<{0}: FormsWebPart runat=server></{0}: FormsWebPart >”)]
    [XmlRoot(Namespace = ” ProfessionalSharePoint2007.FormsWebPart “)]
    public class FormsWebPart : System.Web.UI.WebControls.WebParts.WebPart
    {
    }

Since you have now appropriately modified the class in order to assimilate into the WebPart framework and made the necessary references to draw on ADO.NET 2.0 functionality in order to submit user entered items to the backend SQL data store, the relevant child controls need to be instantiated in order to capture user input.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>