Monday, October 10, 2016

Apply filter on calendar view

Whether we use Dataview or List view webpart, we can filter the data according to our need. Filtering will be based on value of other column of the list. But what if we want to apply filter in the calendar view of the list? If we will use dataview using sharepoint designer, filter option will not come. We will have to write some code in .Net to achieve that. An alternate way is a bit simple. Suppose we want to display the calendar Item and appointments which are scheduled on current day. It can be achieved using ListView webpart as below-

1. Take a List view Calendar webpart.

2. Create a calculated column say 'StDate' whose value will be determine from the column 'start time'.

3. open the page in edit mode and edit the webpart. edit toolpane will be opened.

4. Click on modify this view.

5. In filter section select the column StDate and give its value [Today].

6. Click Ok.

Thats It. Now it will filter according to the value of the calculated column 'StDate'.

Ofcourse the filtering condition will be based on other column value of the calendar. Means we can apply filter on Calendar view in sharepoint upto a defined level only. But what if we want to filter according to some other parameter say querystring. In that case we will have to write some code in .Net. In code we may create a custom calculated column and assign the value of querystring to that column. that column may be used for filtering .

Hopes it will help.

No comments:

Post a Comment