7 votes
Accepted

the file '/_controltemplates/.ascx' does not exist

Fixed it by using the following code: private const string _ascxPath = @"~/_CONTROLTEMPLATES/15/VisualWebPartProject/Export/ExportControl.ascx"; Note I just added 15 after CONTROLTEMPLATES.
user avatar
  • 3,614
7 votes
Accepted

Create WSP package in Visual Studio 2013

Package a WSP Right click your project in the right column. Then click "Publish". A dialog will open, where you will get to choose where to place the resulting .wsp file. After clicking "Publish" ...
user avatar
7 votes
Accepted

When developing web parts, which is better server context or client context?

I think if you have no limitation on using the server object model, that would be the best option. In my opinion, these are the advantages: Better performance Code more "ordered" Compiled code ...
user avatar
5 votes
Accepted

JSOM peoplepicker 500 error

Using JSOM in the past I have experienced this trouble when I have a lack of system resources, specifically when my systems RAM has less than 5% available. The fact that you are getting a Service ...
user avatar
4 votes

the name 'initializecontrol' does not exist in the current context visual studio 2013

You are probably missing VisualWebpartName.ascx.c.gs file under your VisualWebpartName.ascx. Right click your VisualWebpartName.ascx and select Run Custom Tool . This will recreate .c.gs file and all ...
user avatar
  • 485
4 votes
Accepted

the name 'initializecontrol' does not exist in the current context visual studio 2013

I finally found one solution. It has all to do with the url of the site. It should be a valid url. It is a bit strange though because the url that I was providing was valid. To test it I created a new ...
user avatar
  • 1,897
4 votes

Visual Web Part vs Visual Web Part (Sandboxed)

The original (Farm Solution) Visual Web Part uses a User Control for the UI. The User Control gets deployed up into the SharePoint System Folders and the Web Part just dynamically loads the User ...
user avatar
  • 11.5k
4 votes

Error occurred in deployment step 'Activate Features'

When you use Visual Studio to build your visual web part. In the Feature Design mode we you gave the scope of feature as Farm by mistake and when we try to deploy the solution you will get the error ...
user avatar
  • 7,855
4 votes

Dynamically get List ID from List Name

You should always select your list based on the URL, as the Title is more likely to change. And don't do SPWeb.Lists as this will enumerate all lists on the web site. Use this similar snippet instead: ...
user avatar
4 votes

Getting custom webpart property with JSOM

You need to load webpart properties before you can read them. That is, var properties = webPart.get_properties(); currentCtx.load(properties); Then read the properties in success method. currentCtx....
user avatar
4 votes
Accepted

Star Wars error "use the force"

Set Always Force Install to True in for your feature. (Assuming you are using Visual Studio)...Check the feature property window and you should see this option! If you are using PowerShell, you can ...
user avatar
4 votes
Accepted

SP13 - Deploy and debugging stop work for other developers in project

Its common that SharePoint Sites stops working for a while till the deployment completes as it includes IIS Application Pool Recycle retracting/adding solutions and its assemblies into layouts folder. ...
user avatar
  • 495
4 votes

SP13 - Deploy and debugging stop work for other developers in project

Arun's solution would work, but another is to give each developer their own dev environment. So, each dev would have their own server to work on. If you haven't thought about this before, then it may ...
user avatar
  • 7,930
4 votes
Accepted

SP16 On-Premise - SPFx web parts or Classic web Parts?

SPFX web is not supported yet in SP2016 on-primise. It will be available via Feature Pack. https://rencore.com/blog/sharepoint-framework-webinar-qa-follow-part-1-sharepoint-framework Currently ...
user avatar
3 votes
Accepted

Changing visibility of text/controls in a visual web part

First of all, you have an update panel. With that you have a few options. You could wire up a server side event to your button and hide the div on button click. The button click would cause an Async ...
user avatar
  • 1,678
3 votes
Accepted

Storing data entered into a custom web part

It depends on what you want to do with the data, I'd say. In general, I would recommend the custom list approach, especially if the purpose of the form is to collect data and use it later. Recently, I ...
user avatar
  • 1,128
3 votes
Accepted

Find a div in a SharePoint page from code behind [Visual Webpart]

Why are you using the client side ID. Use the server side ID "abc". It will work. Regards.
user avatar
3 votes

Where to store often used class in Sharepoint 2010?

you can create a separate Project eg. "Common" where you include those classes. You can reference that assembly than from your other Projects. Of course, you have to ensure that this wsp is installed ...
user avatar
3 votes
Accepted

Set DropDownList text and value c#

Try the following: using (SPWeb web = new SPSite(siteurl).OpenWeb(weburl)) { SPList list = web.Lists.TryGetList("MyList"); SPQuery query = new SPQuery(); query.Query = "&...
user avatar
3 votes

Visual Webpart Registration form where data is stored to SQL Database table on button click

It same as you do in C# .net. In your button click event, define a connection string and then insert command. For eg. Sqlconnection con=new Sqlconnection(); con.Connectionstring="Data Source=...
user avatar
  • 4,800
3 votes
Accepted

Alternative approaches to designing workflows for simple approval process in SharePoint

Use the tools the platform gives you. This is built in functionality on libraries. Go to your library settings and click on Versioning settings. Enable content approval. Now click on Workflow ...
user avatar
3 votes
Accepted

SharePoint document library event receiver and WebPart showing items from document library

Which event is your Event Receiver trigging on? Because the -ed receivers are asynchronous by default (which could explain the behavior you're seeing). So, either use ItemUpdating event for your ...
user avatar
3 votes
Accepted

Site not shared message after visual web part click

It all depends on the code you run on the button click. Can you please share it with us? It's more than probably something done by your code, and your user does not have permissions to perform the ...
user avatar
  • 9,686
3 votes
Accepted

Error in CAML query

The name of the columns with spaces have the space represented in Unicode as _x0020_, try the following line: spQuery.Query = "<Where><And><Eq><FieldRef Name='Flag'/><...
user avatar
  • 438
3 votes
Accepted

How to set permission for each web part

Open page in edit mode. Click on webpart A. Click on Webpart properties tab in ribbon. Go to Target audience in Advance section. Select Group A in the field Click Apply and Okay. Repeat same process ...
user avatar
  • 3,596
3 votes
Accepted

Read text file entry in visual web part (C#)

By this way, you can achieve your solution, Please Update the logic as for your context. using (SPSite oSPsite = new SPSite("http://website url/")) { using (SPWeb oSPWeb = oSPsite.OpenWeb()) ...
user avatar
  • 1,712
3 votes

Sharepoint 2019 visual webpart with SQL database

If the SharePoint 2010 WSP solution was developed correctly, it will still work just fine in SharePoint 2013, 2016 and 2019. It has to be noted that there is no OOB "upgrade" procedure that will ...
user avatar
2 votes

Deploy Farm Solutions to Online SharePoint 2013

In SharePoint Online you can not use Farm solutions! You are limited to sandboxed solutions and Apps. You would have to rewrite and rearchitect your solutions to one of those two patterns. For ...
user avatar
2 votes
Accepted

may i know how to use list field iterator ?will u pls give one scenario?

Listfielditerator control renders each field in a list item with an appropriate control. A single line text field will be rendered as a text box while a lookup field will be rendered as combo box. ...
user avatar
  • 7,855

Only top scored, non community-wiki answers of a minimum length are eligible