Sharepoint Visual Web Part does not have a .cs file - sharepoint

I am trying to create a visual web part that has some properties associated with it so that I can use them as settings for the web part. I am trying to follow this tutorial however whenever I create a new "Visual Web Part" project it does not create the .cs file that they refer to in the tutorial.
Instead it creates the following:
Elements.xml
WebpartName.ascx
WebpartName.ascx.cs
WebpartName.ascx.g.cs
WebpartName.webpart
I am guessing that this is related to the SDK that I have installed:
Microsoft SharePoint 2010 SDK - version 14.0.4763.1086
Am I doing something wrong or should I try to get a different version of the SDK or is there a way that I can introduce webpart properties using this type of file structure? All of the examples I have seen thus far refer to the "WebpartName.cs" file.

Yes, you are right that Sharepoint 2013 Visual Web Part does not have a .cs file, but you can still add custom properties to the visual webpart using the .ascx.cs file.
Please refer the attached link for detailed steps:
http://www.ashokraja.me/articles/How-to-create-a-custom-property-and-set-a-default-value-in-a-SharePoint-2013-Visual-WebPart
Regards,
Deepali

Related

Create Form Template from existing ones

Is there any way that I can create a template within forms to utilize for every user in the company?
For instance; let's say I have the Sales Order Screen (SO301000) and the Document Detail grid configured in certain way, that display different amount of columns than the default (either more or less columns).
For each user I want to use this template (and all the ones created) that I will apply when I add the new user.
I'l appreciate any guidance and help.
EDIT:
I provided answer for Form element ASP template below. Although reading your question again I think what you're trying to do would be more along the lines of automating grid column configuration. We call this feature Default Table Layout.
There's a feature request for it here:
https://feedback.acumatica.com/ideas/ACU-I-415
The feature has been shipped in version 2017R2 and is documented here:
https://help.acumatica.com/(W(1))/Main?ScreenId=ShowWiki&pageid=30f3229f-20f1-4055-9c03-e0fe3b37080d
Image copy of documentation page:
For ASP Form templates
There are two ways to work with customizations in Acumatica:
As a Customization Project, everything is done directly in Acumatica
instance through the web browser using the Customization Project Editor.
As an extension library (DLL file) compiled in Visual Studio which is then included in the FILES section of a Customization Project.
For method 1, I believe creating custom templates would be a bit of a hack and would not be officially supported, if someone knows otherwise please chime in.
For method 2, we ship the Visual Studio templates with the Acumatica Configuration Wizard (Acumatica ERP Installer).
Those templates are in the following folder:
My Documents\Visual Studio 20XX\Templates\ItemTemplates\Visual C#
The templates will be available for ASP.NET solution only. You can open Acumatica Instance Website as a solution if the website is already deployed:
When you open Add New Item dialog:
The Acumatica Templates will be available:
Those are standard Visual Studio templates so you can copy and re-use them to create your own. Microsoft documentation for creating user template applies and you can follow their guidelines. Note that working with Visual Studio and creating your own template is somewhat less user friendly than using Acumatica Customization Project Editor.
Acumatica T100 covers using Visual Studio to create customizations and would be a good starting point to learn the techniques involved:
https://openuni.acumatica.com/courses/development/t100-introduction-to-acumatica-framework/

Create Biztalk 2013 artifact for sharepoint in visual studio

To create artifacts(schemas and ports) from WCF, webservice or database to be used in visual studio project, I right click the project and I choose Add Generated Items under the add menu and the related adapter generates them.
I have a case where I need to integrate data from sharepoint 2010 in my project. is there a way to generate these artifacts for a sharepoint list in my project?
As far as I know, you don't need to generate any schemas for SharePoint.
To populate a list for example you would need to fill in the properties of the SharePoint adapter by promoting an XML file as a property.
You can find more information here: http://jpsmit.bloggingabout.net/2013/01/24/biztalk-server-2013-sharepoint-adapter-walkthrough/

SharePoint 2010 VS development: Intellisense for ASPX files

I'm using Visual Studio 2010 to develop a SharePoint Server 2010 solution. Part of this includes custom Page Layouts, but when editing them, intellisense is completely broken, since Visual Studio doesn't appear to know how to handle them. Here's what I've done:
Created a new blank solution
Right-clicked on the solution and created a new "Empty SharePoint Project"
Right-clicked on the project and created a new "Module"
Renamed sample.txt to MyPageLayout.aspx or created a new ASPX Web Form
At this point, intellisense for the new Page Layout is broken. It gets even worse with tools like ReSharper installed. Also, things like "Format Document" will break the Page Layout (by for example changing asp:Content to asp:content)
What I've tried to get intellisense working:
Added a Web.config from a standard Web Application Project to the root of the SharePoint Project - made no difference.
Added the ProjectGuid for a Web Application Project to the SharePoint project file - broke the project.
Is there any way to get intellisense, and the rest of the support Visual Studio can offer for Web Forms, available when developing SharePoint 2010 Page Layouts?
I have followed your post to some extent.
Using VS2010 (On an x64 machine)
Create a blank SharePoint solution. (this properly combines your #1 & #2)
Add a module (in SharePoint a module is like a folder or resource container)
added a new class to the module (intellisense present)
Added a new webpart to the module (intellisense present)
added a user control to the project designer works and (intellisense present)
I believe that you should consider creating true server or visual web parts. This will have a harder learning curve but will pay with dividends in the future. You will be able to package and deploy your solution again or to another server/farm. Aspx pages can be added and manipulated by the dreaded SharePoint designer. In 2010 the theory is that those designer mods can be packaged and deployed.
I work in this environment every day and the best advice I can give is to embrace the SP object model and do 'it' the sharepoint way. Don't try to force SP to be something its not. :)
This is probably not the solution you are looking for but it's the best thing I found for SharePoint development.
In your solution, create 2 projects :
1 SharePoint Project (empty or not)
1 ASP.NET web application project
Develop all your UI (aspx pages, ascx controls, etc.) in your ASP.NET project and create post-build steps that will copy the pages and controls to the appropriate folders in your SharePoint solution.
That way, you will benefit from all the features of web development in visual studio and it will be very easy to deploy as well. It is a bit of a time investment at first, but it is well worth it if you have any considerable amount of logic to implement in your aspx pages.
This blog post documents what you need to do.
you can add an intellsense to pagelayouts by closing the page and simply reopen it from
file->openfile->your file page layout path
Or you can directly "Right Click" on the file you want to open from the Solution explorer and then select "Open" : you'll get the Intellisense !

SharePoint 2010 - Creating a custom document library template

I'm trying to figure out if it is possible to create a custom document library template for SharePoint 2010. When a user clicks on the Libraries link on the quick launch menu of a new SharePoint site, and then clicks the Create button, the Create dialog is launched.
I know this dialog window hosts a Silverlight control, but obviously there is a way to create custom template types in this window. There is even a category that is called Blank & Custom. I've tried copying and modifying the DocumentLibrary feature located in the following location - C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES, but that didn't seem to work.
Thanks for reading, I'm sure the answer is obvious but I've been stumbling over Google and MSDN all morning trying to figure this out but I haven't had any luck.
Well, unfortunately the answer is not that obvious. You'll have to create a new List Definition (a document library is actually a list). For that there are several ways, but as a developer, I guess the most common way is to do that through Visual Studio.
A basic tutorial that will guide you through the steps can be found here:
http://msdn.microsoft.com/en-us/library/ms466023.aspx
After you deploy your solution, a new list template (or document library, depending what you created) will show up in the dialog.
Yes, it is not that obvious at all.
Most of the Microsoft documentation is now based on using Visual Studio 2010 and are more focused on the lists than on the document libraries.
By the way, as told by Erwin, document libraries in SharePoint 2010 seems to have become lists, but the lack of documentation regarding the creation of custom lists remains anyway, so after having perform some successful trials I have decided to publish a step by step guide.
Sharepoint 2010 custom ducoment library

How to get a product key token from a library file programatically?

I am creating a SharePoint solution project that will install the Telerik dll files into the GAC and write the appropriate lines into the webconfig upon feature activation. My question is, is there a way to get the product key token, version, and culture info of a dll programatically. I have used the System.Reflection.Assembly.GetExecutingAssembly() before to get the embedded resources, such as a javascript file, and add it to the appropriate folder. Would this be the same way to get the dll file, and if so what would I do to get the assembly info of an embedded assembly? Thanks for any direction.
See this related question.
Out of curiosity, where in your web.config are you adding references to Telerik DLLs? I recently did a project that uses the Telerik Silverlight controls. While I had to configure the web.config to support the .Net 3.5 framework, I did not have to add anything specifically for the Telerik DLLs as their controls were all wrapped within my custom Web Parts.

Resources