Sunday, March 31, 2013

ObservableCollection in ASP.NET

This simple example will help you to understand and how to use the "ObservableCollection" class list and INotifyPropertyChanged interface.Both are playing important role in WPF and Silverlight application implementation and especially on MVVM pattern. Where an entity class updating the IEnumarable and collection list,INotifyPropertyChanged event trigger to update the View Model. Here is straight forward workaround.I have a class with three members like FirstName,LastName and City. As soon as you hit the button save it will bind to the DataGrid control in Silverlight. I did in SharePoint 2013.
        public MainPage()
            List Name = new List();
            autoCom.ItemsSource = Name;
        ClientContext context;
        Web web;
        private delegate void UpdateUI();
        private void btnSave_Click(object sender, RoutedEventArgs e)
            context = ClientContext.Current;
             web = context.Web;
             context.ExecuteQueryAsync(Onsuccess, OnFailure);
        public void Onsuccess(object sender, ClientRequestSucceededEventArgs e)
            UpdateUI obj = ShowResult;

        public void OnFailure(object sender, ClientRequestFailedEventArgs e)
        public void ShowResult()
            ObservableCollection list = new ObservableCollection();
            list.Add(new observableList(txtFirst.Text, txtLastName.Text,autoCom.Text));
            MyGrid.ItemsSource = list;
Create the class and inherit with INotifyPropertyChanged interface.
 public class observableList : INotifyPropertyChanged
        private string fName;
        private string lName;
        private string city;
        public string FirstName
            get { return fName; }
            set { fName = value;

        public event PropertyChangedEventHandler PropertyChanged;
        public string LastName { get { return lName; } set { lName = value; NotifyPropertyChanged("LastName"); } }
        public string City { get { return city; } set { city = value; NotifyPropertyChanged("City"); } }
        public void NotifyPropertyChanged(string param)
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(param));
        public observableList(string f,string l,string c)
            this.fName = f;
            this.lName = l;
   = c;


Wednesday, March 27, 2013

jQuery integration in SharePoint

This blog may be very simple but it really useful to understand "How to integrate the jQuery  in SharePoint WebPart or SharePoint Application Page"

First approach
You can use the Module to include the jQuery file if you developing the "Sandbox" solution and refer the file path in script tag.

Second approach

In farm solution,you can include the jQuery file in _layout folder and for best practice create the "1033" folder inside the _layouts and refer in script tag.
Here you can use the SharePoint Script Link control also

Instead of using Google or Microsoft hosted CDN you can download the file and host in your local sharepoint server.

Sunday, March 24, 2013

SharePoint 2013 – App feature

  • SharePoint 2013 app will runs in isolated app domain.
  • You can create the root level DSN or sub domain to pointing your SharePoint app in SharePoint hosted type app.
  • It will not get deployed under System account when you trying to deploy the app in Visual studio.
  • To run you App you need to create you site based on “Developer Site”.
  • Each app will shares the subsite of your site collection.
  • The subsite created through app deployment will not be visible under “Site Contents”.

HTML Field Security in SharePoint 2013

SharePoint 2013 had new feature called HTML Field Security,It will restrict the user to place any of the websites in the iframe in pages of your site.
You can set the below permissions
  • Do not permit contributors to insert iframes from external domains into pages on this site.
  • Permit contributors to insert iframes from any external domain into pages on this site.
  • Permit contributors to insert iframes from the following list of external domains into pages on this site.
Simply you need to add the site names in the list box to restrict or allow the users to use the iframe.
*This feature will not helpful when user trying to put the iframe in webpart through code.

Community site template in SharePoint 2013

Community Sites are new in SharePoint 2013.
They provide forums for people to ask and answer questions, post information, comment on posts and get rewarded for their efforts in the form of points, earned badges, and gifted badges. Those that are familiar with the Microsoft forums will see a lot of similarities.
Much of the functionality in those forums has been built into the SharePoint Communities Sites. Additional components that are found in social networks such as “liking” a post are also included.
This set of functionality can be extremely powerful in encouraging the sharing of knowledge and contributing of content.
You can create the new site or you can activate the feature in existing site collection to use community site.
Site Settings->Site Action->Manage Site Features – Activate the “Community Site Feature”
if you are not able to see the “Community Site template” first activate the “SharePoint server standard collection feature”.

Tuesday, March 12, 2013

Napa Office 365 Development Tool

The Napa Office 365 Development Tools  which is available only to the site collection which is based on "Developer Site" template.

Because it use the isolated sandbox for development activities.

You can develop the office and sharepoint application in browser itself and doesn't require to install any development tools.
How to activate the "Napa" tool for your Office 365 site.Here I am using SharePoint 2013,if you are using the Office 365,SharePoint 2010 the visual steps may be slightly differ from this.

Napa Office 365 Development tool
 Step 2

Napa Office 365 Development tool

Step 3
Napa Office 365 Development tool

Step 4
Napa Office 365 Development tool
Step 5

Tuesday, March 05, 2013

SharePoint 2013 prerequisites

SharePoint 2013 prerequisites are below:
• Microsoft .NET Framework 4.5
• Windows Management Framework 3.0
• Microsoft SQL Server 2008 R2 SP1 Native Client
• Windows Identity Foundation
• Microsoft Sync Framework Runtime v1.0 SP1 (x64)
• Windows Server AppFabric
• Microsoft Identity Extensions
• Microsoft Information Protection and Control Client
• Microsoft WCF Data Services 5.0 and
• Cumulative Update Package 1 for Microsoft AppFabric 1.1 for Windows Server (KB2671763)

Site Column creating via code

Site columns can be created while site provisioning and later these field can be attached to content type and associating this content type to a specific list. Place below code in "Feature Receiver".
 public string _firstNameText = "";
        public string _secondNameText = "";    

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
            using (SPSite site = (SPSite)properties.Feature.Parent)
                using (SPWeb web = site.OpenWeb())