how do I use today's date as the default value for a Query String paramater?
This is what I have so far but I cannot figure out how to set the default value to today's date if the parameter is not passed in the query string.

<ParameterBinding Name="meetingDay" Location="QueryString(meetingDay)" DefaultValue="???"/>


August 28th, 2015 11:54pm

Hi,

As a workaround, add a query string filter web part in the list view page. Then add the following JavaScript in to the list view page.

<script type="text/javascript">
window.onload=function(){
    var today=new Date();
    today=(today.getMonth()+1)+"/"+today.getDay()+"/"+today.getFullYear();
    var currentURL=window.location.href;
    if(currentURL.indexOf("meetingDay=")<0){
    	if(currentURL.indexOf("?")>=0){
    		window.location.href=currentURL+"&meetingDay="+today;
	    }else{
	    	window.location.href=currentURL+"?meetingDay="+today;
	    }
    }	
}
</script>

Best Regards,

Dennis

Free Windows Admin Tool Kit Click here and download it now
September 4th, 2015 2:34am

I am trying to do this in a DVWP. If I use JS then the page will load and then reload and I want to avoid that. I want the DVWP to work such that the provided meetingDay value is used on page load if it is there else today's date is used.

Imagine a calendar where on the page load it shows events for meetingDay or today if no meetingDay query string is provided.

September 7th, 2015 10:54pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics