Francis Shanahan

Folks, I have a bunch of web applications with their own user interfaces written in ASP.NET 2.0

I'd like to host some of these within Sharepoint and I need to understand the most efficient way of doing this . The approaches I've come up with are as follows

a) Rewrite the user interfaces as WebParts. Have to code the UI by hand, no design time support. This feels REALLY inefficient from a coding standpoint but will likely end up the cleanest solution.

b) Host as iFrames - drawbacks are you lose theme support and a host of other UI features. Also iFrames mean more than 1 URL per page which is undesirable.

c) Host UserControls written in ASP.NET in SonOfSmartPart - Feels like a kludge. I'd rather not be reliant on open-source code if I can avoid it. I'd also perceive a performance hit from this SoS intermediate layer.

One alternative I've come up with is to build a code converter that'd take a UserControl, including markup, let's say something like this:

<asp:GridView ID="GridView1" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84"
BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2">
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />

And convert that ASPX markup into C# code resembling this:

dgGrid = new DataGrid();
dgGrid.EnableViewState = true;
dgGrid.AutoGenerateColumns = false;
dgGrid.AllowSorting = true;
dgGrid.HeaderStyle.BackColor = Color.SlateGray;
dgGrid.HeaderStyle.Font.Bold = true;
dgGrid.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
dgGrid.AlternatingItemStyle.BackColor = System.Drawing.Color.Gainsboro;
dgGrid.EnableTheming = true;
dgGrid.AllowPaging = true;
dgGrid.PageSize = 15;

This'd be a one-time conversion that could be plugged into the IWebPart interface and perhaps speed up development along the lines of option a) above.

I'd like to understand the best-practices around WebPart development, how have you avoided developers coding UI by hand How have you maximized investment in already developed web interfaces

Given the number of existing ASP.NET sites, I definitely want a better answer than "you need to rewrite as WebParts".

Any help is appreciated,

Re: SharePoint - Development and Programming Efficient WebPart Development

Ishai Sagi

I dont understand your reluctance to use son of smart part. its open source cred's are actually appealing.

As for myself, I actually prefer writing my code in c# and not markup, so I never had the chalange you mention. But since you are asking, you have two options:

  1. rewrite as web part
  2. host in a user control (either one you write or use the open source one)

using Iframes is not something I would recommend, unless you have an entire application that you are happy with and just want to make it look inside the portal and not actually be inside the portal