|
|
|
|
|
Home
»
SharePoint
»
How to use User control as web part in share point
|
|
|
|
Author Rank :
|
|
|
Page Views :
|
2979
|
|
Downloads :
|
13
|
|
Rating :
|
Rate it
|
|
Level :
|
Beginner
|
|
|
|
|
Download
Files:
|
|
|
|
|
|
|
|
|
|
|
|
It is very easy to develop share point web part using User controls in ASP.net
ic .ASCX file. If you use User control for share point development you can save
a lot of time. Especially when dealing with design of the web part. I have
attached the code for loading a user control please have a look
This has two parts
I. Developing the User control
II. Loading user Control as Web part
First part is easy just use ASP.Net user control for your code
For the part II
1. First you have to put the user control (ASCX file and .CS file of User
control)in _Layouts folder of share point .You can even create folder inside
_Layouts and put your files there. Another way is you can place the ASCX file in
_layouts and the .CS file you can publish as a dll and can place in BIN folder
of the application
2. Then Go to Visual studio File->New Project then select Class Library
as your project

3. Then Add share point reference

4. Add the below name spaces
-
using Microsoft.SharePoint;
-
using System.Web.UI;
-
using Microsoft.SharePoint.WebPartPages;
5. Add the path and name of your user control as shown below.Mine is
Demo.ascx and I placed it unde Demo folder in layouts

6. Don't forget to strong name if you are going to deploy this web part in
GAC .
7. Now you have the webpart that will load the user control.Now you
deploy this web part as normal as you do.
|
|
Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post
Here.
|
|
|
|
|
Login
to add your contents and source code to this article
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional
consulting company, our consultants are well-known experts in .NET and many of them
are MVPs, authors, and trainers. We specialize in Microsoft .NET development and
utilize Agile Development and Extreme Programming practices to provide fast pace
quick turnaround results. Our software development model is a mix of Agile Development,
traditional SDLC, and Waterfall models.
|
|
Click here to learn more about C# Consulting. |
|
|
|
|
|
|
|
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon.
Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees.
As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
|
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
|
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
|
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
|
|
|
|
|
|
|
|
|
|
|
|
|