Posted by: reuben | June 24, 2009

WSS vs MOSS

I find a lot of people asking me this at times – what’s the difference between Windows SharePoint Services and MOSS (Microsoft Office SharePoint Server).

Simply put – WSS 3.0 and MOSS 2007 are collaboration tools made available by Microsoft. Both these tools are build on Microsoft’s .NET platform.

Either one or both products are used to communicate, collaborate, and share data within an organization. The most basic difference between the two solutions is the upfront investment.

Basically, WSS is the free framework that runs the underlying objects that make up “SharePoint”. MOSS is a commercial enterprise collaboration and portal application that runs on top of this WSS framework. In short, WSS is free to most companies whereas MOSS requires a minimum of software purchases and sometimes requires a hardware purchase.

Windows SharePoint Services 3.0 (WSS) ships bundled with the purchase of Windows Server 2003 or Microsoft Small Business Server 2003. This allows organizations to quickly implement WSS and setup an internal company web. The creation of sites and spaces is easy and once the underlying foundation is set up, requires little if no assistance from an organization’s IT team. Microsoft Office SharePoint Server 2007 (MOSS 2007) takes the collaborative foundation of WSS to another level. With an additional software investment, MOSS 2007 allows organizations to take the foundation laid by WSS v3.0 and expand on it. Additional features sit on top of WSS, use the core WSS framework, and extend it in such a way that is beneficial to larger companies, enterprise deployments, and portal scenarios. Below is a short list of key differentiating features and functions inherent to MOSS 2007

Posted by: reuben | December 28, 2008

Customizing SharePoint – Part 1: Designing your Site

As a SharePoint developer, you’ll often be tasked with modifying the “look and feel” of a your clients default site. This you’ll need to do to make sure your customer’s site doesn’t look like an “out of the box” installation of SharePoint. Though this might sound like a hard task - trust me, it isn’t. If you’ve done it once, you can do it a 100 times over. And each time you do, you’ll get better at it! 

In the first part of this Branding SharePoint series, I am going to provide some tips for how to start your design process. The design you create will totally depend on you – let your creativity drive you! Let’s get started.

Start Here!

As stated on Wikipedia, web design is a process of “conceptualization, planning, modeling, and execution of electronic media content delivery via Internet in the form of technologies (such as markup languages) suitable for interpretation and display by a web browser or other web-based graphical user interfaces (GUIs).

 

The intent of web design is to create a web site (a collection of electronic files residing on one or more web servers) that presents content (including interactive features or interfaces) to the end user in the form of web pages once requested.” The same concepts apply when you design a site in SharePoint! You’ll need the following basics before we dive into the realm of customizing you site in SharePoint:

 

·         Logo

·         Color Scheme

·         CSS

·         Images

o    Tip: If you don’t have any images and would like some, you can purchase some for $50+ depending on source, resolution and target purpose. Sites like MorgueFile.com or SXC.hu have some low budget images.  Another option is to grab your camera and take pictures yourself or you could just go to www.istockfoto.com to search for royalty free stock images and photos or browse a giant selection of stock photography.

 

Where do I find that stuff?

Several elements such as your companies marketing policies, sales and management guidelines, will dictate a lot of what you can or can’t do. Depending on the organization, design elements may already be outlined in official documents that have been approved or are in use.  If you don’t have any of these resources, look to other elements already available (web sites, brochures, etc) to find logos, colors and images.  If this doesn’t do it for you or you don’t have any of these resources, start to think about descriptive words that describe your project, company or purpose.  You could also take a look at www.colorschemer.com which is a professional color matching application for anyone from hobbyists to advanced professionals. It allows you to work with a dynamic visual color wheel, instantly explore harmony relationships and even let ColorSchemer Studio intelligently suggest color schemes for you.

 

Done designing, here’s what’s next?

Now that you have identified design elements, you can start working on a prototype, or comp, for your SharePoint design.  For you or the person building the design, being a SharePoint expert is not a requirement, but it does help to be somewhat familiar with the interface and the application itself.  There is a lot to SharePoint and detailed comps for several sample SharePoint screens will make the development process go much smoother.  The site designer should spend some time in the interface checking out SharePoint and clicking beyond the home page. Here are some things to consider in regards to your design:

 

·         Site Navigation 

o    SharePoint has and uses a lot of it.  Make sure your design accommodates the navigation you need to use. Don’t forget about things like the breadcrumbs, the welcome menu and Site Actions.

o    Off, on and hover – A lot of SharePoint elements have off states, on states when the item is active, and hover states.  The design needs to provide detail for how these different states should be handled.

o    Expanded menus, tree view and fly-outs – If your site is using any nested navigation, make sure you have design specs for the various levels and treatments.

·         Toolbars – There are several toolbars used in SharePoint on various screens, plus form field backgrounds.

·         Content – web parts, calendars, publishing areas

·         SharePoint functionality – what SharePoint interface features do you want to keep in the new design? Think about page titles, site titles, page images, navigation menus, etc.

·         Splash page and sub page - Will your site design have a splash page (a home page with a different layout and look)? If so, you will need a sub page design that focuses on content delivery.

·         Custom web parts and functionality – if you will have custom features on your site, make sure the interface has been created in a comp for developer reference.

 

Are we done yet?

Almost. Here’s a quick recap:

·         Identify resources for design

·         Become familiar with the SharePoint interface

·         Identify SharePoint interface elements you need in your final design

·         Using your resources and SharePoint knowledge, create multiple comps for the home page, sub page and other subsequent screens to show design treatment for navigation bars, toolbars, web parts and other types of content.

Part 2: Coding for your design

The next part in this series will focus on how to create the code for your design.

 

Posted by: reuben | December 28, 2008

Enterprise Library 4.1

Enterprise Library 4.1

The folks over at Microsoft have done a great job with Enterprise Library’s new version – v4.1 which features all of the blocks you know and love updated for Visual Studio 2008. This also includes the new (and much anticipated) Unity Application Block for dependency injection. Here are two websites that can point you in the right direction to becoming an EntLib expert:

Here’s a summary of the official release notice from Grigori’s blog:

New features of EntLib v4.1

This release of Enterprise Library includes the following:

  • Integration with the Unity Application Block
  • Windows Management Instrumentation (WMI) 2.0 support and improved instrumentation
  • Performance improvements (particularly, in the Logging Application Block)
  • Pluggable Cache Managers
  • Visual Studio 2008 support
  • Bug fixes

Note: existing public APIs (v3.1) are still supported.

The Application Block Software Factory and the Strong Naming Guidance Package are not included in this release but are available as a separate download. Thus, there is no longer a dependency on Guidance Automation Extensions (GAX).

For the detailed list of all changes, see About This Release of Enterprise Library.

EntLib Getting Started!

If you are new to the Enterprise Library:

If you already know and love the Enterprise Library:

  • check out the change log for this release;
  • upgrade to V4.1—no code change is required—simply update the references to the corresponding application block assemblies and to the common assemblies;
  • download the updated QuickStarts and run through the Unity-integrated examples to get the flavor of new dependency injection style of using the Enterprise Library;
  • join the webcast in June 2008 (I’ll announce the exact date later).

Feel free to shoot me an email with any questions you might have!

Posted by: reuben | April 16, 2008

The GridView

I have to admit – the GridView’s an extremely useful control that ships with Asp.net. This post covers several tasks you can accomplish in a GridView including:

  1. Sorting
  2. Paging
  3. Inserts
  4. Updates
  5. Deletes

Obviously, the techniques covered in this article aren’t the only way of accomplishing these tasks. There are several other approaches too but the one covered here served my purpose the best.

Before I start, I’d like to mention the obvious – A GridView is an improvement over .NET 1.x’s DataGrid. DataGrids, though extemely useful, still suffered some limitations. It required writing several lines of code repetitively to accomplish the same task. For example, binding data to a DataGrid required writing several lines of code. Asp.net 2.0 addressed issues like these through a set of data source controls “designed to encapsulate data that can be bound to data web controls.” A GridView was one such enchancement.

Ok let’s start.

Here’s a pretty simple GridView:

<asp:GridView CssClass=GridView DataKeyNames=ProductID

        ID=GvProducts runat=server

        AutoGenerateColumns=False CellPadding=0 CellSpacing=1

        ForeColor=#333333 GridLines=None Width=100%

        BorderWidth=0px BorderStyle=Solid BackColor=White

        Font-Size=15px

        PageSize=10

        OnRowEditing=GvProductsEditCommand

        OnRowCancelingEdit=GvProductsCancelCommand

        OnRowUpdating=GvProductsUpdateCommand

        OnRowDeleting=GvProductsOnDeleting

        AllowPaging=True

        AllowSorting=True

        OnPageIndexChanging=GvProductsPageIndexChanging

        OnSorting=GvProductsSortCommand>

 

   <HeaderStyle Font-Bold=True ForeColor=Black

            Font-Names=Verdana Font-Size=10px

            HorizontalAlign=Center VerticalAlign=Middle

            Wrap=False Height=25 />

   <FooterStyle ForeColor=Black></FooterStyle>

   <Columns>

 

      <asp:TemplateField  ItemStyle-BorderWidth=1px Visible=False HeaderText=ProductID>

         <ItemTemplate>

            <asp:HiddenField ID=HdProductID runat=Product Visible=False Value=<%# Eval(“ProductID“)%>‘ />

         </ItemTemplate>

      </asp:TemplateField>

 

      <asp:TemplateField  ItemStyle-BorderWidth=1px SortExpression=ProductName HeaderText=Product Name>

         <ItemTemplate>

            <asp:Label ID=LblProductName runat=Product Visible=true CssClass=StandardText Text=<%# Eval(“ProductName“)%>‘ />

         </ItemTemplate>

 

         <EditItemTemplate>

            <asp:TextBox ID=TxtProductName Enabled=true Runat=server Text=<%# Eval(“ProductName“)%>‘ />

         </EditItemTemplate>

         <ItemStyle Width=18% HorizontalAlign=center />

      </asp:TemplateField>

 

      <asp:TemplateField  ItemStyle-BorderWidth=1px SortExpression=Cluster HeaderText=Product Description>

         <ItemTemplate>

            <asp:Label ID=LblProductDescription runat=server CssClass=StandardText  Text=<%# Eval(“ProductDescription“)%>‘ />

         </ItemTemplate>

 

         <EditItemTemplate>

            <asp:TextBox ID=TxtProductDescription Enabled=true Runat=server Text=<%# Eval(“ProductDescription“)%>‘ />

         </EditItemTemplate>

         <ItemStyle Width=18% HorizontalAlign=center />

      </asp:TemplateField>

 

      <asp:CommandField HeaderText=Action ShowDeleteButton=true ItemStyle-BorderWidth=1px ShowEditButton=True

         DeleteText=<img alt=’Save Changes’ src=’../../Images/delete.gif’ width=’15′ height=’15′ border=’0′>

         UpdateText=<img alt=’Save Changes’ src=’../../Images/save.png’ width=’15′ height=’15′ border=’0′>

         CancelText=<img alt=’Cancel Changes’ src=’../../Images/save_cancel.png’ width=’15′ height=’15′ border=’0′>

         EditText=<img alt=’Edit’ src=’../../Images/edit.gif’ width=’15′ height=’15′ border=’0′>>

         <ItemStyle HorizontalAlign=Center Width=8% />

      </asp:CommandField>

 

   </Columns>

   <RowStyle BackColor=#ECECEC ForeColor=#333333 />

   <SelectedRowStyle BackColor=#FFCC66 Font-Bold=True ForeColor=Black />

   <PagerStyle BackColor=#ececec ForeColor=#333333 HorizontalAlign=Center />

   <AlternatingRowStyle BackColor=White />

</asp:GridView>

 

a

Here, I store two important variables in my page’s ViewState. They are:

  1. DsProducts – A DataSet that contains list of all my products.
  2. SortDirProducts – A boolean flag that holds the sort direction selected for my products (ASC or DESC).

a

/// <summary>

   /// View State Variable

   /// </summary>

   public DataSet DsProducts {

 

        get { return (DataSet)ViewState["DsProducts"]; }

        set { this.ViewState["DsProducts"] = value; }

   }

 

   /// <summary>

   /// Holds sort direction for GridView

   /// </summary>

   public bool SortDirProducts {

 

        get { return (bool)ViewState["SortDirProducts"]; }

        set { ViewState["SortDirProducts"] = value; }

   }

 

a

DsProducts is initialized within the PageLoad function via the “DoDisplayProducts()” function. This function simply queries the database for a list of all existing products. This list is then bound to our GridView and is used to initialize our ViewState variable – DsProducts.

 /// <summary>

   /// Page load logic

   /// </summary>

   /// <param name=”sender”></param>

   /// <param name=”e”></param>

   protected void Page_Load(object sender, EventArgs e) {

 

        if (!IsPostBack) {

 

            //Display all products

            DoDisplayProducts();

 

            //Initialize Sort Direction

            ViewState["SortDirProducts"] = true;

        }

   }

 a

 

We also initialize the “SortDirProducts” variable within the PageLoad function.

/// <summary>

   /// Displays servers available within the monitor app.

   /// </summary>

   protected void DoDisplayProducts()

   {

 

        //Initiate the Lookup Business Object

        LookupBO LBO = new LookupBO();

 

        try {

 

            this.DsProducts = LBO.GetProducts();

 

            if (this.DsProducts != null) {

 

               if (this.DsProducts.Tables[0].Rows.Count > 0) {

 

                    this.GvProducts.DataSource = this.DsProducts;

                    this.GvProducts.DataBind();

                    this.GvProducts.Visible = true;

               }

            } else {

 

               //Display Msg

               this.LblResultServer.Text = “No Products Added.”;

               this.LblResultServer.Visible = true;

            }

        } catch (Exception Ex) {

 

            Console.WriteLine(Ex.ToString());

            this.LblResultServer.Text = Ex.Message;

            this.LblResultServer.Visible = true;

        }

   }

a

So far, we’ve got a list of products from the database, bound this list to our GridView and intialized our Sort Direction variable.

Next, lets go ahead and define our OnSorting event. This function is fired each time a user tries to sort data within a column. Also, it’s important to note, that a column will allow sorting only when a valid SortExpression is provided. In our GridView’s case, we’ve supplied the necessary dataset column names that allow sorting our data.

/// <summary>

   /// Function fired when a column name is clicked within the GridView

   /// This function sorts the GridView Based on the columns selected

   /// </summary>

   /// <param name=”sender”></param>

   /// <param name=”e”></param>

   protected void GvProductsSortCommand(object sender, GridViewSortEventArgs e) {

 

        try {

            //Set Sort Expression

            ViewState["SortExpr"] = e.SortExpression;

 

            //Retrieve DataView for DsProducts

            DataView DvData = new DataView(this.DsProducts.Tables[0]);

 

            //Based on value of the SortDirProducts View State value,

            //Set the value of the SortDirStr varible to sort ASC (Ascending) or DESC (Descending)

            string SortDirStr = “”;

            if ((bool)ViewState["SortDirProducts"]) SortDirStr = ” ASC”;

            else SortDirStr = ” DESC”;

 

            //Sort DataView

            DvData.Sort = (string)ViewState["SortExpr"] + ” “ + SortDirStr;

            ViewState["SortDirProducts"] = !(bool)(ViewState["SortDirProducts"]);

 

            //Bind GridView to sorted DataView

            this.GvProducts.DataSource = DvData;

            this.GvProducts.DataBind();

 

            //Display GridView

            this.GvProducts.Visible = true;

 

        } catch (Exception Ex) {

 

            Console.WriteLine(Ex.ToString());

            this.LblResultServices.Text = Ex.Message;

            this.LblResultServices.Visible = true;

        }

   }

a

Easy enough right? If you notice closely we toggle the value of our “SortDirProducts” variable between “ASC” and “DESC”. This allows the user to switch between ascending and descending sorts on a column. It’s also important to note, that we initialized the “AllowSorting” property of the our GridView to “true” as follows:

AllowSorting=True

Next, let’s go ahead and define our PageIndexChanging functionality. First and foremost, it’s very important that we set a “PageSize” for our GridView and set the “AllowPaging” property of the GridView to “True”. Once this is done, we can handle our paging as follows:

 /// Page index changing event

   /// </summary>

   /// <param name=”sender”></param>

   /// <param name=”e”></param>

   protected void GvProductsPageIndexChanging(object sender, GridViewPageEventArgs e) {

 

        GvProducts.PageIndex = e.NewPageIndex;

        GvProducts.DataSource = GetDataViewProducts();

        GvProducts.DataBind();

   }

 

   /// <summary>

   /// Create a View for the DataSet containing the servers

   /// </summary>

   protected DataView GetDataViewProducts() {

 

        if (ViewState["SortExpr"] != null) {

 

            //Toggle the Sort Direction each time the GerReportView method is called.

            if (ViewState["SortDirProducts"] == null) {

               ViewState["SortDirProducts"] = true;

            }

 

            //Based on value of the SortDirProducts View State value,

            //Set the value of the SortDirStr varible to sort ASC (Ascending) or DESC (Descending)

            string SortDirStr = “”;

            if ((bool)ViewState["SortDirProducts"]) SortDirStr = ” ASC”;

            else SortDirStr = ” DESC”;

 

            GvDataViewProducts = new DataView(this.DsProducts.Tables[0]);

            GvDataViewProducts.Sort = (string)ViewState["SortExpr"] + ” “ + SortDirStr;

            ViewState["SortDirProducts"] = !(bool)(ViewState["SortDirProducts"]);

 

        } else {

 

            GvDataViewProducts = DsProducts.Tables[0].DefaultView;

        }

 

        return GvDataViewProducts;

   }

a

This technique ensures that sorting (if any) is still intact when a user is paging through the results. Now, lets take a look at how we can insert, update and delete new items within our GridView.

/// <summary>

   /// Function fired when editing an item within the GridView

   /// </summary>

   /// <param name=”sender”></param>

   /// <param name=”e”></param>

   protected void GvProductsEditCommand(object sender, GridViewEditEventArgs e) {

 

        //Set Edit Index

        this.GvProducts.EditIndex = e.NewEditIndex;

        int ItemIndex = (GvProducts.PageIndex * GvProducts.PageSize) + e.NewEditIndex;

 

        //Bind Gridview to DataSource

        this.DoDisplayProducts();

 

        try {

 

            //Display Text Box in Edit Mode with “Product Name”

            TextBox TxtProductName = (TextBox)GvProducts.Rows[this.GvProducts.EditIndex].FindControl(“TxtProductName”);

            if (TxtProductName != null) {

 

               string ProductName = this.DsProducts.Tables[0].Rows[ItemIndex]["ProductName"].ToString();

               TxtProductName.Text = ProductName;

            }

 

            //Display Text Box in Edit Mode with “Product Name”

            TextBox TxtProductDescription = (TextBox)GvProducts.Rows[this.GvProducts.EditIndex].FindControl(“TxtProductDescription”);

            if (TxtProductDescription != null)

            {

               string ProductDescription = this.DsProducts.Tables[0].Rows[ItemIndex]["ProductDescription"].ToString();

               TxtProductDescription.Text = ProductDescription;

            }

 

        } catch (Exception Ex) {

 

            Console.WriteLine(Ex.ToString());

        }

   }

 

   /// <summary>

   /// Function fired when cancelling an edit command within the GridView

   /// </summary>

   /// <param name=”sender”></param>

   /// <param name=”e”></param>

   protected void GvProductsCancelCommand(object sender, GridViewCancelEditEventArgs e) {

 

        try {

 

            this.GvProducts.EditIndex = -1;

            this.GvProducts.DataSource = this.DsProducts;

            this.GvProducts.DataBind();

 

        } catch (Exception Ex) {

 

            Console.WriteLine(Ex.ToString());

        }

   }

 

   /// <summary>

   /// Function fired when updating an item within the GridView

   /// </summary>

   /// <param name=”sender”></param>

   /// <param name=”e”></param>

   protected void GvProductsUpdateCommand(object sender, GridViewUpdateEventArgs e) {

 

        //Set Edit Index

        this.GvProducts.EditIndex = e.RowIndex;

 

        //Retrieve new server name

        TextBox TxtProductName = (TextBox)this.GvProducts.Rows[e.RowIndex].FindControl(“TxtProductName”);

        string ProductName = TxtProductName.Text;

 

        //Retrieve new cluster name

        TextBox TxtProductDescription = (TextBox)this.GvProducts.Rows[e.RowIndex].FindControl(“TxtProductDescription”);

        string ProductDescription = TxtProductDescription.Text;

 

        //Retrieve ProductID

        HiddenField HdProductID = (HiddenField)this.GvProducts.Rows[e.RowIndex].FindControl(“HdProductID”);

        int HdProductID = Convert.ToInt32(HdProductID.Value);

 

        try {

 

            AdminBO Bo = new AdminBO();

            bool ReturnCode = Bo.UpdateProduct(HdProductID, ProductName, ProductDescription);

 

            if (ReturnCode) {

 

 

               this.LblResultProduct.Text = “Details for “ + ProductName + ” update successfully!.”;

               this.LblResultProduct.Visible = true;

               this.LblResultProduct.CssClass = “StandardTextGreen”;

               this.GvProducts.EditIndex = -1;

               this.DoDisplayProducts();

            }

 

        } catch (Exception Ex) {

 

            this.LblResultProduct.Text = “Failed to update server details.”;

            this.LblResultProduct.Visible = true;

            this.LblResultProduct.CssClass = “StandardTextRed”;

 

            Console.WriteLine(Ex.ToString());

        }

   }

 

   /// <summary>

   /// Function fired when deleting an item within the GridView

   /// </summary>

   /// <param name=”sender”></param>

   /// <param name=”e”></param>

   protected void GvProductsOnDeleting(object sender, GridViewDeleteEventArgs e) {

 

        int HdProductID = Convert.ToInt32(this.GvProducts.DataKeys[e.RowIndex].Value);

 

        try

        {

 

            AdminBO Bo = new AdminBO();

            bool ReturnCode = Bo.DeleteProduct(HdProductID);

 

            if (ReturnCode)

            {

               this.LblResults.Text = “Product Deleted Successfully.”;

               this.LblResults.Visible = true;

               this.LblResults.CssClass = “StandardTextGreen”;

               this.GvProducts.EditIndex = -1;

               this.DoDisplayProducts();

            }

        }

        catch (Exception Ex)

        {

            this.LblResults.Text = “Failed to delete server.”;

            this.LblResults.Visible = true;

            this.LblResults.CssClass = “StandardTextRed”;

 

            Console.WriteLine(Ex.ToString());

        }

   }

a

If you have any questions or want to download ths code, please leave me a comment. Once again, this I want to stress that I’m not claiming this technique of inserting, sorting, deleting etc. to be the best. It’s the one that matches my requirement the best.

« Newer Posts - Older Posts »

Categories