Posts

Multi Level Grouping in SharePoint List Programmatically

<SharePoint:ListViewByQuery ID="TestID" runat="server" /> In Code Behind:  SPList oList = web.GetList("SampleList"); TestID .List = oList; SPQuery query = new SPQuery(oList.DefaultView); query.Query= "<GroupBy Collapse='FALSE'><FieldRef Name='Title' /><FieldRef Name='Subject' /></GroupBy>"; TestID .Query = query; Hope this will helps you!!! Happy coding....

ASP.net Ribbon

Ref :  http://aspnetribbon.codeplex.com/

How to print a panel in SharePoint 2010

< Script type ="text/javascript">         function printform() {             var printContent = document.getElementById( " <% = pnlFullForm.ClientID %> " );             var windowUrl = "about:blank" ;             var uniqueName = new Date();             var windowName = "Print" + uniqueName.getTime();             var printWindow = window.open(windowUrl, windowName, "left=50000,top=50000,width=0,height=0" );             printWindow.document.write(printContent.innerHTML);             printWindow.document.close();    ...

Controls not working after Export to Excel or Export to PDF

Add the following script to your webpart / custom control that need to have export and other controls functionals So here you go with the working solution. < script type ="text/javascript" language ="javascript">     //sharepoint postback to work after clicking on export to excel button     if ( typeof (_spBodyOnLoadFunctionNames) != 'undefined' &&                                            _spBodyOnLoadFunctionNames != null ) {         _spBodyOnLoadFunctionNames.push( "supressSubmitWraper" );     }     function supressSubmitWraper() {         _spSuppressFormOnSubmitWrapper = true ;   ...

Client object Model Using Silverlight in SharePoint (Getting Records From SharePoint List)

ClientContext context = new ClientContext ( ApplicationContext .Current.Url);     context.Load(context.Web);   List Projects = context.Web.Lists.GetByTitle( "Opportunity Financial Data" );   context.Load(Projects);              CamlQuery query = new Microsoft.SharePoint.Client. CamlQuery ();   string startDateFx = FirstDate.ToString( "yyyy-MM-dd" );   string endDatFx = LastDate.ToString( "yyyy-MM-dd" );   camlQueryXml = "<View><Query><Where><And><Geq><FieldRef Name='Created' /><Value IncludeTimeValue='FALSE' Type='DateTime'>" + startDateFx + "</Value></Geq><Leq><FieldRef Name='Created' /><Value IncludeTimeValue='FALSE' Type='DateTime'>" + endDatFx + "</Value></Leq></And></Where></Query></View>" ;   query.ViewXml = camlQueryXml;   _financi...

Group By records , Sum of records using LINQ

int cityTotals = cities . GroupBy ( c => c . City ) . Select ( grp => new { City = grp . Key , Total = grp . Sum ( c => c . Total ) }) . Where ( c => c . Total > 20 ) . Sum ( c => c . Total );

Java script validations for Radio button list (atleast one must be selectable)

var RBPurpose = document.getElementById( " <% =rtbPurposes.ClientID %> " ); var radio1 = RBPurpose.getElementsByTagName( "input" );      for ( var i = 0; i < radio1.length; i++) {                 if (radio1[i].checked) {                     break ;                 }                 else {                     ErrorMsg = "Fields marked with (*) cannot be left blank" ;                 }             } ...