Sharepoint 2007 user control or webpart - asp.net

I need to write some functionality to present on a sharepoint site which needs to work with a back end sql database. I would also like to leverage the core functionality of this 'component' in a standard ASP.net website. I am a newbie with SharePoint and especially with old version like 2007, is it best to do this as a webpart or a user control. What would be the benefits / drawbacks of each.
Appreciate any guidance / links to other materials.
thansk

if you create user controls you will be able to use them in another project - the drawback is that SP2007 is ASP.net 2.0/3.5 as is SP2010; but in Asp.Net you can take full advantage of .Net 4.0 and above.
A User control - specifically designed as a standalone control will be re-usable in more projects so make sure you add it in its own project rather than wrapping it up into the SharePoint Web Part project.

If I have to make a choice then at that moment I will prefer the User Control.
There arae mainly two advantages of that.1. You can reuse it in any other project if it will require same functionality like this one.2. As Mauro said SP 2007 is Asp.net 2.0/3.5. You can work with that one too.
AS you are a new bee in sharepoint you can work with the asp.net more easily then wrapping it in the sharepoint web part object.
hope my answer help you in decision

Related

Use OrchardCMS, Umbraco or DotNetNuke as a component in ASP.NET application

OrchardCMS, Umbraco and DotNetNuke are CMSes in .Net galaxy. They work as stand alone applications well. Suppose I have a requirement that need CMS features in an another ASP.NET MVC application. I do not like to implement CMS again in the application. Rather I like to use current CMSes as a component of application.
Is it possible at all to use for example OrhcardCMS as a component of my MVC application? It is ideal to have relations between CMS and application itself, for example I can load entities from CMS, update them etc.
I know there are integration techniques in .Net. For example ASP.NET Identity integrates with ASP.NET applications in core level, but view (CSHTMLs) must be copied and customized in most cases. Or Hangfire and ELMAH that integrates with an application without need to copy view (cshtml, html, css) to the target application. Indeed it is good to know that integration methods are available regarding plugging CMSes into ASP.NET applications.
I can tell you more about Umbraco as I don't know other CMS as much as this one. There is a whole course / training for those who want to integrate their apps with Umbraco: https://umbraco.com/products-and-support/training/umbraco-application-integration/. So yes, it's possible and it's even suggested way from my perspective to use already done piece of software rather than building the wheel once again.
Umbraco is an ASP.NET MVC application. You can use Umbraco components, backoffice, membership and everything else CMSish delivered out of box and still you're able to write and use your business logic, controllers and everything else what you've created inside your ASP.NET MVC / C# app. Still, it's an ASP.NET app, so you can use anything what you want from the .NET world. We're using ELMAH.io for example to take care of logging and keeping the errors in the cloud. We're also using a ton of 3rd party, both open-source and commercial tools and softwares to do multiple things around our web components. Umbraco is not blocking us from using them or anything else. I like to consider Umbraco as a framework or library helping us to deal with content editing and giving us a massive number of opportunities to offer for our clients or editors.
Speaking for OrchardCMS, there are some questions touching this subject already, see
Reusing Orchard's Core to build another extensibility framework
Extracting a Module from Orchard
If it's possible for you then try to setup Orchard as the base system and move your MVC application in a module. This will be much easier than trying to cut out peaces of Orchard. In return you get amazing possibilites when running Orchard as the underlying framework, e.g. Localization, Modules, Themes, the whole user / role management etc.
OrchardCMS 2 is currently developed towards single components that can be reused in any application but it's far from finished yet.

Is it possible to create a website and avoid the built-in ASP.NET controls with ASP.NET Webforms but still get the same functionality?

Is it possible to create a website and avoid the built-in ASP.NET controls with ASP.NET Webforms but still get the same functionality?
As stated on various websites, using built-in ASP.NET controls vs HTML controls does represent both an advantage but also a disadvantage, so I'm curious to find out if it's possible to avoid the built-in ASP.NET controls but still get the same functionality as the controls would offer?
I know about MVC and I do not plan to use it, since I'm running ASP.NET through MONO.
Take a look at ASP.NET/MVC - it doesn't use any of the webforms controls.
Update, seeing as MVC is not an option:
Of course, you could just write your own controls from scratch or some third party controls.
I don't see any benefit in that. If you are going to use webforms, use the built in controls when appropriate.
You can use just plain old html control in ASP.NET web forms. You have to add the runat="server" to the html control and you can use it on the server side. You could build a whole site that way. Although technically that's the literal control. I supposed you could write the whole page using inline code and plain old html . https://msdn.microsoft.com/en-us/library/ms178135.aspx I'm Not sure what mono supports.

Asp.net MVC VS ASP.net WebForms?

I am starting a new project in VB /.Net Framework 2.0 for a company corporate website with data driven forms. So should I go further with Asp.net MVC or Asp.Net web forms and WHY ??? We are not ready for Ajax now but later.
And also we have DevExpress components.
Actually I see ASP.NET MVC as next generation in that it is an evolution - trying to be a better programming environment, as software development for web apps asks for something more testable.
It is a huge beast. Decide based on features whether you need it. MVC has less documentation and is a lot harder to master thanks to a less RAD approach, but it seems that once you are in, it will be quite a better experience. If you have a web application (like stackoverflow.com) then it may be a good approach.
DevExpress components - have fun... throwing them away. Like most ASP.NET components they will not work or only work very partially. Totally different approach.e
ASP.Net MVC is not "next generation" ASP.Net. It's an alternative approach to design that can be more beneficial depending on the kind of project you're working with. Without more information about the particular type of project you're working on no one can give you any informed recommendations.

ASP.NET vs Infopath for forms

We use Infopath at work, quite frequently for form design and then we integrate this into MOSS 2007.
What I don't yet know is what advantages are there to designing a form in Infopath as opposed to making a webpage (eg ASP.NET/C#) to allow for the same intention?
Thanks
Maintenance is easer, integration with sharepoint is easier,database submission/retrieval is easier, and workflows are easier with infoPath.
Customization is more robust, and database submission/retrieval is more robust in asp.net.
Basically, use infoPath if it's easy. Use C# if it contains a lot of custom things.
I've only used InfoPath for one or two things in MOSS. It seems to me that InfoPath is a bit more integrated into MOSS than trying to use .Net webforms from a data retrieval/modification standpoint. That being said, virtually everything we have been doing in SharePoint lately that isn't easily done in a webpart has been done through .Net webforms.
From a flexibility standpoint I think you have more options with the .Net framework then what you get in InfoPath, especially if we have to use multiple form that interact with one another almost like an embedded SharePoint webapp.

Sharepoint controls in ASP.NET application

Is there a way I can use the sharepoint controls in a ASP.NET web application like any other controls that come out of box for ASP.NET? If yes, what are the pre-requisites I need to install?
Thank you,
Harsha
Yes, you can use SharePoint "controls" in an ASP.NET application, as long as the application is running in SharePoint.
In other words, the prerequisite is SharePoint.
Most controls have internal dependencies on SharePoint (i.e. they use SPContext or SPWeb internally). Also, since they are contained within the Sharepoint Assemblies, you can not just take the .dlls and put them in your app.
In short: In most cases, it will be better to re-build them using reflector. Which one are you looking at?
What specific controls are you referring to? Those that you find in SharePoint Designer?
If you are referring to Web Parts in WSS v3, those that are using the ASP.NET Web Part as the base web part (the recommended approach) may work fine in ASP.NET since the Web Part class inherits from Panel which inherits from Web Control (going from memory here) - all ASP.Net classes. It would just depend on whether the web part has any SharePoint specific code which is highly dependent upon the web part.
Host the application in SharePoint's _layouts directory (see this video for more details). Your ASP.NET app will then be "running in SharePoint" and have access to all SharePoint controls.
Note that some controls don't work unless they are running on an actual SharePoint page.

Resources