Tag Info

Hot answers tagged

9

Short explanation: As far as usage is concerned, in many common cases there are almost no actual differences - anything you can do with a webpart you could do with a visual web part. For many points of view the visual web part is only a tool that enables the developer to work with a user control instead of creating all controls in codebehind. Visual web ...


6

I suggest you should deal with the problem after going through httphandler development and its deployment in IIS 7 and ASP.NET 3.5. Here is a good link : http://msdn.microsoft.com/en-us/library/bb398986(v=VS.90).aspx (See various walk-through and consider asynchronous handlers as you deal in asynchronous way) If you think you know it all, Please ensure : ...


5

Do you know how to build a basic web part? If not I suggest you learn this first. Here's a sample tutorial: http://msdn.microsoft.com/en-GB/library/ms415817(v=office.14).aspx Next you want to learn how to develop against web services. Helpfully, Yahoo have a tutorial on how to deal with responses to web services as XML within C# applications: ...


4

At least you should use the following approach instead of jquery ready function: <script type="text/javascript"> function TheFunctionToDoTheWork() { // Do the work here } // "Subscribe to the SharePoint "page load" _spBodyOnLoadFunctionNames.push('TheFunctionToDoTheWork'); </script> The document.ready in many cases fires too early in ...


4

You can't use AppGlobalResource or <%$Resources:RESXFILE,RESOURCEKEY%> in Sandboxed solutions. See Localization in SharePoint 2010 Sandbox Solutions for how to use resources in Sandboxed solutions.


4

If you don't want other people to be able to Reverse Engineer the source code to DLLs you're giving them, then you should obfuscate the DLL. See .Net Obfuscation for some suggestions. But before going in that direction I have a couple of comments: The only people who can get the DLL is the people with access to WSP (or the farm where it's installed). Not ...


3

I believe you can accomplish what you want by adding some code to the property declaration like this: public string TextBox1 { get { if(!String.IsNullOrEmpty(_TextBox1)) { return _TextBox1; } else { return "My Default"; } } set {_TextBox1 = value;} } string _TextBoxl; To be honest there is so much information in your question it is ...


3

To deploy your file so that SharePoint can access it, you have several options but in your case as it is needed only by your feature event receiver you can deploy it under the feature's root folder. To do so, simply put your file inside a module with a deployment type of "ElementFile". Something like: <?xml version="1.0" encoding="utf-8"?> ...


3

I think that <%@ Assembly Name="$Sharepoint.Project.AssemblyFullName$" %> when you deploy on your prod server, that code is not replaced by Visual Studio, thus you need to specify full name of the assembly you have developed, you can get it from .webpart file. That happens due to http://msdn.microsoft.com/en-us/library/ee231545.aspx, VS 2010 ...


3

WebParts (including SummaryLinkWebPart) are simply classes of type Control, so they can be directly added to the masterpage, as Ziga pointed out. First you'll need to add a TagPrefix to the top of your masterpage with the rest of the Tagprefixes to load the appropriate assembly: <%@ Register Tagprefix="SharePointPublishingControls" ...


3

First a number of small remarks: Usually you don't hardcode the URL of the site you want to work against. It may be ok but if you want to access the current site the just use SPContext.Current.Web Unless you need to make updates on a get you shouldn't set AllowUnsafeUpdates A listbox will not allow you to add images inside it (so in my code I just added a ...


3

The Page object you're getting in the Sandboxed webpart isn't the real page, so this in one of the things that won't work. Option 1: Render in RenderContents You can manually render your script include in RenderContents: protected override void RenderContents(HtmlTextWriter writer) { string jQuerySrc = Page.ClientScript.GetWebResourceUrl(this.GetType(), ...


3

If you wanted to do it the "right" way then you should have used Feature Upgrading. It's unfortunately not simple but gives you a lot of control of what happens when you deploy a new version of a feature. In your case it would have involved: Add the elements.xml files for the new web parts inside <ApplyElementManifests> inside ...


3

To add the normal people picker to a web part you can use Microsoft.SharePoint.UserControls.PeopleEditor or <SharePoint:PeopleEditor ID="myPeoplePicker" runat="server" Width="300" BorderStyle="Solid" BorderColor="Black" BorderWidth="1" /> Check out the below link, it has complete code: ...


3

Your code should look like below, its a base class that the webpart calls.... in the base class im setting the webpart settings, Iv made a custom one for you where you will see it in the properties of the webpart when you edit the webpart. private const string c_YourCustomVairable = ""; public BaseWebPart() { _YourCustomVairable= ...


3

Source: Control Web Part Load Order If so you can set these properties in the Property Bag, have a look at SPWeb.Properties. You can modify either in a web browser or via code using the SPLimitedWebPartManager. Use the MoveWebPart method to reorder. Hope this helps


3

I think the problem is src attribute of tag. Try <script src="/StyleLibrary/js/jquery-1.9.1.min.js" /> and take a look at this article Edit If you decide to store js in _layouts folder, use <SharePoint:ScriptLink runat="server" ID="ScriptLinkJQuery" name="/Js/jquery-1.9.1.min.js" Localizable="false" />


2

When adding resources to mapped Resource folder you are placing resx files to <hive>\xx\Resources\ folder and your web part cannot access them. Proper place for this kind of resource is IIS application App_GlobalResources folder (x:\Inetpub\wwwroot\wss\VirtualDirectories\<port>\App_GlobalResources\). Fore more info you can read SharePoint ...


2

(Edit) Sorry, I have deleted my previous answer because I didn't noticed that you said that you have changed your control namespace to be the same used in the Register tag. You said that the exact error is "Could not load file or assembly 'AppsListWebPart'"... could you try to change the AppsListWebPart string in your register comand to the assembly full ...


2

I had the same problem as you. I created a custom web server control based on SPGridView and tries to add it to my Visual Web Control. I solved the problem with this 2 steps. <%@ Register TagPrefix="cc1" Assembly="CustomSpGridView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=562a273772bbe3d8" Namespace=CustomControl" %> Add this to the page ...


2

If you need to create an HttpHandler in SharePoint 2010, you need create a source file with the .ashx extension that contains your code and drop it into your \12\TEMPLATE\LAYOUTS\ folder. The bad deal is that this solution is usefull only if you need to create a preatty simple HttpHandler programming using inline code with no possibilty to debug or test ...


2

Generally, Visual web parts should be created if you want to fully utilize the designer capabilities in Visual Studio.(For e.g. to allow for features such as drag and drop as well as double clicking controls to wire up events). A Visual web part implementation includes an ASP.NET user control, i.e. an .ascx file. All the UI controls and logic goes in user ...


2

Yes you are correct. None of the above options work in Sandbox. I got around this issue by using the JavaScript window.location = "new url" and then pushing it to the page using the ClientScriptManager.RegisterClientScriptBlock method. http://msdn.microsoft.com/en-us/library/btf44dc9.aspx


2

I have now discovered why I couldn't save the custom properties in the GUI. I was closing the Current Web Object from the SPContext. Apparently this should not be done as it's handled by the framework. Once I removed my CurrentSite.Dispose() from my finally in the webpart user control, I was able to properly save the custom properties.


2

To rename the Title that will be visible for the end user, open Elements.xml-file in the webpart-module. Locate the <File>-element and add <Property Name="Title" Value="My Display Title" /> The Elements could look like something like this: <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/" ...


2

Since SummaryLinkWebPart is sealed class you cannot inherit from it. This means you need to develop your own custom web part from scratch with same functionalities. You can use some decompiler like ILSpy to examine original code but (!) keep in mind legal issues and also read this.


2

for starters, you are calculating start and end dates differently DateTime StartTime = Convert.ToDateTime(item["EventDate"]); DateTime EndTime = Convert.ToDateTime(item["EndDate"] ).Date; You should also use Convert.ToBoolean() rather than casting it as x = (bool) object. I've seen the latter fail in strange ways and if that happens to be the case ...


2

It sounds like bad DNS resolution from Visual Studio, or bad user credentials. So you have a web application at http://wpnne76648:2010, and wpnne76648 is the local name of your server? Do you have alternate access mappings in place for the FQDN also? If you open a browser on this server and point it to http://wpnne76648:2010 does the web application open? ...


2

Common issue is: The web part is located on a page of subsite, and tries to retrieve data from '/_layouts/somefolder/somehandler.ashx'. But this url is the url of root site which user have not access to. In this case you should use '<%= SPContext.Current.Web.ServerRelativeUrl %>/_layouts/somefolder/somehandler.ashx' $.ajax({ url: "<%= ...


2

I've found updating wsp's can be a little tricky sometimes. Sometimes doing a full Uninstall-SPSolution/Remove-SPSolution will help if you are experiencing strange behavior. In my experience deploying form visual studio usually goes off without a hitch. Because of this, I will try to match it's deploy process as closely as possible if I am having a deploy ...



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