Posts

Export Gridview to PDF

http://www.dotnetspider.com/resources/29759-Exporting-GridView-PDF.aspx

Using the SharePoint ‘Person or Group’ field in code

 string[] Groupname = PLPSurveyAttendees.CommaSeparatedAccounts.Split(',');                                     string Users = string.Empty;                                     foreach (string survueygroupname in Groupname)                                     {                                         SPGroup ogrp = oWeb.Groups[survueygroupname];                                                                            User...

Delete SharePoint Lists Programmatically

 using (SPSite osite = new SPSite("SiteURL"))             {                 using (SPWeb oweb = osite.OpenWeb())                 {                     SPListCollection olistcoll = oweb.Lists;                     Hashtable ht = new Hashtable();                     foreach(SPList olist in olistcoll)                     {                         if (olist.Title.StartsWith("Test"))                         {                             ht.Add(olist.ID, olist.Title);    ...

Bind the SharePoint List Values to DropDownList using SPDataSource

<SharePoint:SPDataSource runat ="server"  ID="spMaster"  DataSourceMode="List" SelectCommand="<Query><OrderBy><FieldRef Name='SortOrder' Ascending='true' /></OrderBy></Query>" >                                 <SelectParameters>                                 <asp:Parameter Name="WEbUrl" DefaultValue="/SiteName/" />                                 <asp:Parameter Name="ListName" DefaultValue="Your List Name Here" />                                 </SelectParameters>                                 </SharePoint:SPDa...

Set DateTimeControl Region

DtDueDate.LocaleId = Convert .ToInt32( SPContext .Current.Web.RegionalSettings.LocaleId);

Create Folder in Document Library Programmatically

SPDocumentLibrary _MyDocLibrary = ( SPDocumentLibrary )_MyWeb.Lists[ "Library Name Here" ];                  SPFolderCollection _MyFolders = _MyWeb.Folders;                 _MyFolders.Add(_MyDocLibrary.RootFolder.ServerRelativeUrl + "/" + ListItemID + "/" );                               _MyDocLibrary.Update();

Hide the ChangeView option from SharePoint 2010 Ribbon

Based on the KISS principle, there has to be an easier way - and there it is: As an example, if you want to hide the change view, then you can just use the following CSS: <style> #Ribbon\.List\.CustomViews\.DisplayView-Medium{ display:none; } </style>