Sunday, April 04, 2004 9:12 PM Jan Tielens

Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Patrick Tisseghem loves creating SharePoint webparts using ASP.NET user controls, in one of his latest posts he simplifies this technique by using the dynamically compiled assembly (that is build the first time the user control is rendered on an ASP.NET page) which contains the user control. He even made a video that shows step-by-step how this works! Thanks Patrick for the free U2U course! ;-) I think this process could be even more simplified (as Patrick suggests) by using a utility that would compile the ASP.NET user control, without having to render that user control on a web form. I don’t know the compiler parameters that should be used to emulate what ASP.NET does, maybe someone else can help us out? My first experiences in a test environment were quite positive (after referencing the right assemblies :-). The procedure feels a little bit weird (you rely on ASP.NET to compile the user control), but there has to be a cleaner way to get a hold of the assemblies you need…


In a comment Renaud Comte describes even another approach to use user controls to create webparts. He compiles the user control as an embedded resource and uses a generic container. I’ve haven’t tried this technique, but if you’re intresed I recommend to read his blog post which also has a link to the full source code.

Filed under:

Comments

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Thursday, April 08, 2004 9:55 AM by Eric Landes

How about using the technique DotNetNuke Private Assemblies use? It's detailed here http://www.dotnetnuke.dk/DesktopDefault.aspx?tabid=104. Don't know if it would work, but the concept seems to be what you're after. Create a project with only User Controls. However I'm not sure how the debugging would work.

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Friday, April 09, 2004 9:09 AM by Martijn de Groot

Hi,

I've tried to copy instructions in this video in Visual Basic.
In this piece of code in my Calendar.vb:

Private uc As New CalendarControl_ascx
Protected Overrides Sub CreateChildControls()
Me.uc = New CalendarControl_ascx
Me.Controls.Add(Me.uc)
End Sub

It says: "Reference required to assembly 'DemoUserControls' containing the base class 'DemoUserControls.CalendarControl'. Add one to your project."

I have done everything on the video, including the references to the dll and to my other project in the solution. Intellisense also suggests the "CalendarControl_ascx" in it's list, so it sees the reference there.
I don't get it!

# Create SharePoint Webparts With ASP.NET User Controls ( Demo Video!)

Wednesday, April 14, 2004 2:26 PM by TrackBack

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Wednesday, April 14, 2004 5:23 PM by fontecha

Hi
I found the same problem that Martijn de Groot have.
I do same proyect in C# and VB.Net.
The C# work but vb don´t.

any ideas to resolve it?

thx!

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Thursday, April 15, 2004 12:51 AM by Jan

Fontecha, Martijn: I don't have an idea to resolve this... :-(

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Wednesday, April 21, 2004 4:10 AM by Catty

try to replace CalendarControl_ascx
with DemoUserControls.CalenderControl

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Wednesday, April 21, 2004 4:11 AM by Catty

try to replace CalendarControl_ascx
with DemoUserControls.CalenderControl

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Thursday, April 22, 2004 9:51 AM by Martijn de Groot

Thank you! It works. I now have a VB User Control and a C# wrapper. Then also you will have to replace CalendarControl_ascx
with DemoUserControls.CalenderControl.
It then works fine. I assume that a VB wrapper will function the same way.

Thanks!!!

# Some Articles About Creating SharePoint Webparts.

Tuesday, April 27, 2004 11:45 PM by TrackBack

Some Articles About Creating SharePoint Webparts.

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Sunday, June 13, 2004 11:36 PM by Shridhar

if I use ascx file which contains codebehind file and database interaction means it gives me error. but calendar part works great!

Can anybody help to connect ado based ascx file to convert as webpart?

shridhar

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Friday, July 23, 2004 5:03 AM by shantanu

no Comment

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Wednesday, June 28, 2006 8:24 AM by Maerlon

I'm having problems proper displaying the webpart. I only get to see the titlebar, but no calendarcontrol. Can anyone tell me what I might be doing wrong. I'm working with VB.NET. Thanks!!

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Thursday, September 28, 2006 9:07 AM by Paul Roullier

I am new to Web parts and wanted to know if I can build them with VS2005 for Sharepoint 2003 or can only VS2003 be used.  Thanks.  Video link is down but would like to know more.

Roo

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Wednesday, March 07, 2007 4:56 AM by mince verre vitres

ietosnovamy 450617 http://mince.richandprivilegedtravel.com/mince-verre-vitres.html mince verre vitres <a href="http://mince.richandprivilegedtravel.com/mince-verre-vitres.html">mince verre vitres</a>  [URL=http://mince.richandprivilegedtravel.com/mince-verre-vitres.html]mince verre vitres[/URL] mince.richandprivilegedtravel.com/mince-verre-vitres.html [link=http://mince.richandprivilegedtravel.com/mince-verre-vitres.html]mince verre vitres[/link] * http://heroism.richandprivilegedtravel.com/a-mystery-of-heroism.html">http://heroism.richandprivilegedtravel.com/a-mystery-of-heroism.html a mystery of heroism <a href="http://heroism.richandprivilegedtravel.com/a-mystery-of-heroism.html">http://heroism.richandprivilegedtravel.com/a-mystery-of-heroism.html">a mystery of heroism</a>  [URL=http://heroism.richandprivilegedtravel.com/a-mystery-of-heroism.html">http://heroism.richandprivilegedtravel.com/a-mystery-of-heroism.html]a mystery of heroism[/URL] heroism.richandprivilegedtravel.com/a-mystery-of-heroism.html [link=http://heroism.richandprivilegedtravel.com/a-mystery-of-heroism.html">http://heroism.richandprivilegedtravel.com/a-mystery-of-heroism.html]a mystery of heroism[/link] * http://heroism.richandprivilegedtravel.com/heroism_70.html">http://heroism.richandprivilegedtravel.com/heroism_70.html heroism <a href="http://heroism.richandprivilegedtravel.com/heroism_70.html">http://heroism.richandprivilegedtravel.com/heroism_70.html">heroism</a>  [URL=http://heroism.richandprivilegedtravel.com/heroism_70.html">http://heroism.richandprivilegedtravel.com/heroism_70.html]heroism[/URL] heroism.richandprivilegedtravel.com/heroism_70.html [link=http://heroism.richandprivilegedtravel.com/heroism_70.html">http://heroism.richandprivilegedtravel.com/heroism_70.html]heroism[/link] * http://heroism.richandprivilegedtravel.com/ heroism <a href="http://heroism.richandprivilegedtravel.com/">heroism</a>  [URL=http://heroism.richandprivilegedtravel.com/]heroism[/URL] heroism.richandprivilegedtravel.com/ [link=http://heroism.richandprivilegedtravel.com/]heroism[/link] * http://mince.richandprivilegedtravel.com/coupe-mince.html coupe mince <a href="http://mince.richandprivilegedtravel.com/coupe-mince.html">coupe mince</a>  [URL=http://mince.richandprivilegedtravel.com/coupe-mince.html]coupe mince[/URL] mince.richandprivilegedtravel.com/coupe-mince.html [link=http://mince.richandprivilegedtravel.com/coupe-mince.html]coupe mince[/link] * http://mince.richandprivilegedtravel.com/pork-mince.html pork mince <a href="http://mince.richandprivilegedtravel.com/pork-mince.html">pork mince</a>  [URL=http://mince.richandprivilegedtravel.com/pork-mince.html]pork mince[/URL] mince.richandprivilegedtravel.com/pork-mince.html [link=http://mince.richandprivilegedtravel.com/pork-mince.html]pork mince[/link] *

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Tuesday, June 12, 2007 8:48 AM by Ioannes

Sorry :(

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Thursday, June 28, 2007 8:17 AM by Rajendra Maharjan

How about using Form User Controls in SharePoint WebPart? I have tested successfully embedding Form User Control in web but don't know how to embed it in sharePoint site.

If any please mail me to rmpasha@gmail.com

# re: Create SharePoint Webparts With ASP.NET User Controls (+ Demo Video!)

Wednesday, September 19, 2007 4:02 AM by hari

please send me the demo video