Posts

How to maintain scroll position after post back?

How to maintain scroll position in ASP.Net Pages When web pages are posted back to the server, by default user is returned to the top of the page. On a large web page, you might have a requirement to scroll down the user automatically to the last position on the page. MaintainScrollPositionOnPostBack page property can be used to achieve this  in one of the following ways. Application level: To set the property by default for all pages in the website, open web.config and add the attribute to the pages node.<pages maintainScrollPositionOnPostBack=”true”> Page Level: for a particular page, open the aspx and set the property<%@ Page MaintainScrollPositionOnPostback=”true” … Code level:  to set the property programmaticallyPage.MaintainScrollPositionOnPostBack = true; Reference : http://tuvianblog.com/2012/01/06/how-to-maintain-scrollposition-after-post-back/

Add Web Part Programatically on Home / Default Page

Hi, Create a SharePoint 2010 Solution in Visual Studio. Add Feature & its scope. Add Feature Receiver Class & the add below mentioned code :         public override void FeatureActivated(SPFeatureReceiverProperties properties)         {             // Get a reference to a web and a list             SPWeb web = properties.Feature.Parent as SPWeb;             string pageURL=web.RootFolder.WelcomePage;             if(pageURL=="")                 pageURL="default.aspx";             SPLimitedWebPartManager mgr = web.GetLimitedWebPartManager(pageURL  , System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);                          // Add the web part             mgr.AddWebPart(CreatePageWebPart(web.Url), "Left", 1);         }         public override void FeatureDeactivating(SPFeatureReceiverProperties properties)         {             try             {                 // Get a reference to a web and a list      

PDF Viewer Webpart

Image
Download PDF Viewer Web Part solution & code   Hi, Here now presenting PDF Viewer web part solution with code. You can view any pdf file by providing url of the pdf document or you can use this pdf viewer web part as connected web part also. When you install this web part , you will see a “View PDF” button in your ribbon of all document libraries. You can view pdf by clicking on the button from the ribbon. Download PDF Viewer Web Part solution & code Enjoy!!!

Dragable and Resizable DIV

How to create a drag able and resizable div in ASP.Net/C# OR How to make a div Drag able and Resizable using Jquery in ASP.Net/C# Download Code

SharePoint 2013 Important Links

SharePoint Server 2013 Preview Download: http://technet.microsoft.com/en-US/evalcenter/hh973397 SharePoint Foundation 2013 Preview Download: http://www.microsoft.com/en-us/download/details.aspx?id=30345 SharePoint 2013 & Office 2013 Training For Developers: http://msdn.microsoft.com/en-US/sharepoint/fp123633 SharePoint 2013 Training For IT Pros: http://technet.microsoft.com/en-US/sharepoint/fp123606 Start: Set up the development environment for SharePoint 2013: http://msdn.microsoft.com/en-us/library/ee554869(v=office.15 ) Cheers

How to calculate difference between two dates in javascript/jquery

Simple steps to calculate difference between two date fields using JavaScript/JQuery  In some scenario, we need to calculate the difference between two dates from the client side. Here we are going to demonstrate all about date fields using javascript such as Javascript date field validation for different format, difference between two dates in days, hours, minutes, seconds, years and weeks Very strong and simple Javascript validation for date fields for format dd/mm/yyyy  Following javascript function simply verify and return result for checking valid date from client side itself. It will automatically validate leap year entries and return correct result. That means if we pass ’29/02/2011′ to the function it will be return false. If we are passing ’29/02/2012′ to the function it will return true. So we don’t need to bother about the leap year or other complex things. function isValidDate(dateStr) { // Date validation Function // Checks For the following valid Date formats: /

Disable Right click of mouse

How to disable right click functionality from the asp.net web page In some of the web page has the requirement to protect source code from the users. Users can right click the page and take the source code. In order protect right click functionality on the web page we can implement javascript functionality to prevent user’s right click on the web page. So user not able to access features available on the right click menus. By implementing javascript method we can identify the right click event from the user by checking the button code and prevent if the user clicks right click. Below mentioned web page prevented to click right click by the user. When the user trying to right click it will return warning message to user and return the action. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DisableRightClick.aspx.cs" Inherits="ExperimentLab.DisableRightClick" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitio

Crop image

How to crop image using ASP.Net/C# OR Cropping image in C# before upload

Asynchronous file up loader using ajax in ASP.Net

How to create asynchronous file up loader using ajax in ASP.Net

Balloon Popup Extender in ASP.Net/C# with New AjaxControl Toolkit

How to implement BalloonPopupExtender in ASP.Net/C# OR Ballon Popup Extender Sample in ASP.Net/C# Download Example

Hide buttons control from ribbon for specific list

Image
Hi , I want to hide "New Folder" button from ribbon of my library "Shared Documents" for site "SP2010-01".     To hide this button from ribbon for a Shared Documents, You must write this code : using (SPSite site = new SPSite("http://SP2010-01")) { using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists.TryGetList("Shared Documents"); web.AllowUnsafeUpdates = true; SPUserCustomAction actionView = list.UserCustomActions.Add(); StringBuilder newurl = new StringBuilder(); newurl.AppendLine("<CommandUIExtension>"); newurl.AppendLine("     <CommandUIDefinitions>"); //Provide Location ID to hide the button newurl.AppendLine("        <CommandUIDefinition Location=\" Ribbon.Documents.New.NewFolder \">"); newurl.AppendLine("        </CommandUIDefinition>"); newurl.AppendLine("    </CommandUIDefinitions>");

DateTimeControl is not showing it’s calendar in proper format

Image
Hi, Some time we have to create our own customized asp form or visual web part or simple web parts where we use SharePoint’s Date Time Control . Some time that control works properly but some time this control does not show calendar in proper format as we see in SharePoint. Control should show calendar like : But instead of the format, It shows like this : If you want to change this format for default format you have to write this code: dateTimeControl1.DatePickerFrameUrl=ResoulveRul(SPContext.Current.Site.Url+”/_layouts/iframe.aspx”);

Make Read Only or Hide Fields in SharePoint 2010

Hi , If you want to make field as read only or hide fields , you must read this article. It is too good. Just download files & install as instructed. To read full article :  SPUtility To read documents : Documents To download code files : Download

Hide columns / fields in SharePoint

Image
Hi friends , If you want to hide columns / fields without writing codes & without any script, My article will help you to do the same. Just to start, open your SharePoint List & click on list setting button. Then click on “Advanced Setting”. In the Content Type section, set yes for   “Allow management of content types?” & press OK. Now go back to list setting and you will see an new section called “Content Types”. You will get list of content types here. Click on “Item”. You will all fields / columns Click on the column name , which you want to hide, in my case I am going to hide column “Planned End Date”, You will see field detail form. Click on the “Hidden (Will not appear in forms)” and press OK. Now check your all three forms New, Edit and display. You won’t see the field.

Close Model Dialog Box in SharePoint 2010

Hi , If you want to close your open dialog box, you can use below given scripts : To send cancel result on the parent form : SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel,' Your Message Here   ');  also you can use this script to send Cancel result message on the parent form : window.frameElement.cancelPopup(); To send OK result on the parent form from current form : SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, 'Your Message Here');  also you can use this script to send commit result message on the parent form : window.frameElement.commitPopup(); You can use this script in your programming to close the model dialog box in SharePoint 2010

How to change the existing Window Membership Provider to Claims Based Authentication in SharePoint 2010?

$WebAppName = "http://yourWebAppUrl" $wa = get-SPWebApplication $WebAppName $wa.UseClaimsAuthentication = $true $wa.Update() $account = "yourDomain\yourUser" $account = (New-SPClaimsPrincipal -identity $account -identitytype 1).ToEncodedString() $wa = get-SPWebApplication $WebAppName $zp = $wa.ZonePolicies("Default") $p = $zp.Add($account,"PSPolicy") $fc=$wa.PolicyRoles.GetSpecialRole("FullControl") $p.PolicyRoleBindings.Add($fc) $wa.Update() $wa.MigrateUsers($true) $wa.ProvisionGlobally() Source :  http://technet.microsoft.com/en-us/library/gg251985.aspx Extend a Web application that uses Windows-claims authentication (SharePoint Server 2010)

PreSaveAction Function in SharePoint 2010

“ PreSaveAction ” function is JavaScript function which allow programmer to write code with in this function which will execute just before saving records. Programmers can use this function in NewForm.aspx or EditForm.aspx. If you want to stop saving; the function should return false & if you want to execute save function after this function; return true. Syntax is: function PreSaveAction () {      return true; // if you want to execute save functionality of the form.            //return false ;//if you want to stop execution of save functionality of the form. }

How to show appended fields on the forms ?

Add this tag on the form where you want to display versions : < SharePoint:AppendOnlyHistory runat ="server" ControlMode ="Display" FieldName ="Manager_x0020_Comments" ItemId ="{@ID}"/> You just need to change field name value. FieldName property always contains only internal name of the field.

Make fields Disable / Read only on Entry Forms

If you want to disable fields on New Entry Form or Edit Entry form, Use this code to disable fields : // Function To Disable Fields   function disableField(title)   {    for(var i = 0; i < document.all.length; i++)    {     var el = document.all[i];     // find html element with specified title     if(el.title == title)     {      el.disabled = true; // disable      // if the next element has a reference to the current element      // then disable if as well      if(i < document.all.length - 1)      {       var el2 = document.all[i + 1];       if(el2.outerHTML.indexOf(el.id) > 0)       {        el2.disabled = true;       }      }      break;     }    }    }    // END Function To Disable Fields  Call Function within entry form : disableField("Task Description"); disableField("Comment"); disableField("Status");

SharePoint 2007 Interview Questions and Answers

What is Microsoft Windows SharePoint Services? How is it related to Microsoft Office SharePoint Server 2007?   Windows SharePoint Services is the solution that enables you to create Web sites for information sharing and document collaboration. Windows SharePoint Services -- a key piece of the information worker infrastructure delivered in Microsoft Windows Server 2003 -- provides additional functionality to the Microsoft Office system and other desktop applications, and it serves as a platform for application development. Office SharePoint Server 2007 builds on top of Windows SharePoint Services 3.0 to provide additional capabilities including collaboration, portal, search, enterprise content management, business process and forms, and business intelligence. What is Microsoft SharePoint Portal Server?   SharePoint Portal Server is a portal server that connects people, teams, and knowledge across business processes. SharePoint Portal Server integrates information from various syste