Hot answers tagged

7

There's not a huge difference for all of them. 3 out of 4 of them are server-side controls. And the SharePoint:InputFormTextBox and wssawc:InputFormTextBox are the exact same, only the prefix namespace (i.e. SharePoint, wssawc) is the difference. SharePoint/wssawc:InputFormTextBox has built-in co-operative field validation, the others don't. That's the ...


5

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 Activation Exception leads me to believe this may very well be the case, and can be verified in Windows event viewer. Close some applications or disable some ...


4

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.executeQueryAsync(...


4

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: public Guid? GetListId(string siteUrl, string listUrl) { using (var currentSite = new SPSite(siteUrl)) { using (var currentWeb = ...


4

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" your project will be build and then packaged in the selected location. Make sure to have the Solution configuration set to Release when building for production. ...


3

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


3

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 along your other wsps (which use that dll)


3

Try the following: using (SPWeb web = new SPSite(siteurl).OpenWeb(weburl)) { SPList list = web.Lists.TryGetList("MyList"); SPQuery query = new SPQuery(); query.Query = "<OrderBy><FieldRef Name='ID' Ascending='TRUE' /></OrderBy>"; SPListItemCollection collection = list.GetItems(query); ...


2

You can get (or set) the selected value from code-behind (e.g. when user clicks a button) with myDateTimeControl.SelectedDate. EDIT: See https://karinebosch.wordpress.com/sharepoint-controls/datetimecontrol-control/ for examples (SharePoint 2007, but still relevant in 2013).


2

To access SP.WebParts.WebPart Properties it need to be requested explicitly. In your example you could change the expression at the line: currentCtx.load(webPartDefs, 'Include(WebPart)'); with currentCtx.load(webPartDefs, 'Include(WebPart.Properties)'); Modified example var currentCtx = SP.ClientContext.get_current(); var pageFile = ...


2

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=PHANNY-PC\PHANNY; Initial Catalog=db_stuRegisterPay; Integrated Security=SSPI"; string query="insert into Persons_info(perID, latinName, gender, dob, pob, phone, ...


2

There are 3 List Templates for Tasks: Project (Gantt) Tasks (TemplateId: 150) Tasks (2010) (TemplateId:107) Tasks (TemplateId: 171) Did you verify that the requested List is using the Template you ask for?


2

This is the code from my project <asp:DataList ID="dlPaging_Top" runat="server" RepeatDirection="Horizontal" OnItemCommand="dlPaging_ItemCommand" OnItemDataBound="dlPaging_ItemDataBound"> <ItemTemplate> <asp:LinkButton ID="lnkbtnPaging" runat="server" ...


2

I suspect this behavior could be related with JavaScript template itself. It seems that when XLV web part is instantiated via Visual web part, custom template is not applied since clienttemplates.js (part of CSR library) library is not yet loaded. In order to make sure the custom template is registered property, try to enclose it using SP.SOD.executeFunc ...


2

You could use the something like const string scriptKey = "jQuery"; if( !Page.ClientScript.IsClientScriptIncludeRegistered( Page.GetType(), scriptKey ) ) { Page.ClientScript.RegisterClientScriptInclude( Page.GetType(), scriptKey, ResolveClientUrl("~/js/jquery.min.js" ) ); } The key to making this work is that you need to include the same key ...


1

I wrote this code here so I can't guarantee it will work as is. It should get you pointed in the right direction. private Func<string> _func; protected void Page_Load(object sender, EventArgs e) { _func = new Func<string>(GetCurrentUserData); Page.RegisterAsyncTask( new PageAsyncTask( new ...


1

You are passing two strings (name and WOGLicensetext) to your AppendData function, yet in the function you are trying to access a result object, which probably doesn't exist in that scope. So you should change $("textarea#idTxtArGenHtml").append(result.WOGLicensetext); to $("textarea#idTxtArGenHtml").append(WOGLicensetext);


1

When attempting to troubleshoot something like this, remember that F12 is your friend. The CSS tab of most browser debuggers - IE, Chrome, Firefox - will allow you to select an element on the screen and see all CSS affecting it. In the case you describe, the menu element or one of its parent containers is being overridden by a style from one of the following ...


1

I was able to get my solution upgraded from a 2010 project to 2013 using the following. Note that this will update your solution to use the new 2013 API. It is possible to update just the project file but still run in 2010 mode. First edit your .csproj file (for c#). Modify the target framework to this: ...


1

You can save User data as below string[] userarray = a.CommaSeparatedAccounts.ToString().Split(',');; SPFieldUserValueCollection usercollection = new SPFieldUserValueCollection(); for (int i = 0; i < userarray.Length; i++) { SPFieldUserValue usertoadd = ConvertLoginAccount(userarray[i]); usercollection.Add(usertoadd); } ...


1

Not sure but this could be the problem: lvwp.JSLink = "~site/_layouts/15/JS/jquery2.1.1.min.js|~site/_layouts/15/JS/JSLinkFields.js"; I think you should remove the ~site part from the URL:s, like this: lvwp.JSLink = "/_layouts/15/JS/jquery2.1.1.min.js|/_layouts/15/JS/JSLinkFields.js"; Also make sure to set the ClientRender ...


1

The user control which you deploy will be saved inside hive folder inside control templates. If your path is folder path in solution is "MyProject/Webparts/Mywebpart.ascx" then the path which you should use will be like this "~/_controltemplates/15/MyProject/Webparts/Mywebpart.ascx". If you are checking whether page is in edit mode or display mode ...


1

You should try as follow. It will work. <SharePoint:SPGridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowSorting="True"> <Columns> <asp:ImageField DataImageUrlFormatString="~/_layouts/15/MyProject/images/icons/{0}" DataImageUrlField="MyType"></asp:ImageField> </Columns> Hope it will ...


1

I found it here: https://social.msdn.microsoft.com/Forums/de-de/3c6f572b-fc0a-4be2-81c5-28d1220edcab/adding-a-custom-webpart-to-webpart-page-not-a-safe-control-issue?forum=sharepointdevelopment I had to copy the safe control entry in the web.config of the application.


1

The error was due to my ViewFields SPQuery property settings. I must have been using the wrong field names. "Name" is supposed to be "LinkFilename" and "Url" is supposed to be "ServerUrl". I was basing the field names off the SPListItem object model names which are "Name" and "Url". Thanks to Atish for making me check my query results.


1

Tried replicating your issue. For some reason the code behind file is not showing in the solution explorer. Judging from your screenshot, the last line shows that the code behind file has been created. I found the code behind file by right clicking on the *.ascx file and then choosing "View Code."


1

I am going to go ahead an answer this to save some poor soul in the future. The problem was with the App Manifest file. I had the Permissions => Scope set to Site Collection. This needs to be changed to 'Web'.


1

You have to store a string that serializes all your values. Obviously, since the string has now a special meaning, WebBrowsable only won(t do the magic to translate it into a nice selection UI. To handle the UI to display/set values in this string, you'll need to develop your own Tool part. You'll find a lot of examples on the Web, e.g.: ...


1

Adding attachments to list items is completely different than uploading files to a doc lib. You first need to get a reference to the SPPListItem you want to attach to, and then you use myListItem.Attachments.Add. Here's a sample of code that may help you: it attaches multiple files (from local drive instead than from the UplaodFile control, but the story is ...


1

In case this works on your DEV machine, but not in other environments, ensure the folder exists on all WFE servers of the farm (if there are many), as the code may be executed on any of them.



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