1

I am developing a portal in SharePoint 2013 in which I am using Query String URL filter web part, the function of web part is to filter the web parts on the bases of years. I gave the default Year value is 2015 and when the 2016 begin, I need to change the default value to 2016 but this is not a practical solution because on each starting year client need to change default value. Can anyone suggest something to get rid of this problem

0

I know how to do this with a "Text Filter" web part. Just add both a Content Editor Web part and a text filter to your page. Set up your text filter to pass value to whatever web part you need to. Then add following script to your content editor web part. This will get the current year and pass it to your text filter which will pass it on to your other web parts on every refresh.

<script type="text/javascript">
$(document).ready(function(){
var currentTime = new Date();
var year = currentTime.getDate();
getElementById("Id of your text filter goes here").value = year;
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.