Tag Info

New answers tagged


This one worked for me: Highlight YourControl.ascx file in solution explorer. In properties window locate "Custom Tool" property and set it to SharePointWebPartCodeGenerator If your *.ascx file is valid, the ascx.g.cs should be generated as a result In my case mentioned, the property was empty and there was no sign of a g.cs file.


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


The property site.AllWebs returns an object of SPWebCollection which inherits from IEnumerable<T> interface. This interface has a function called OrderBy using which you can order the SPWeb based on their Title property. SPWebCollection webColl = site.AllWebs; IEnumerable<SPWeb> sortWebColl = webColl.OrderBy(w => w.Title); foreach (SPWeb web ...

Top 50 recent answers are included