Add a list on the page and convert it to XLST format.
Step 1: Add two parameters to the list (right-click the list): pstartdate and penddate;
Step 2: After the parameters are created, goCodeView: Find the line (CTRL + F:
<XSL: template match = "/" xmlns: x = "http // www.w3.org/2001/xmlschema"
Replace the following code with the above line:
<XSL: template match = "/" xmlns: x = "http // www.w3.org/2001/xmlschema"
Xmlns: D = "http://schemas.microsoft.com/sharepoint/dsp"
Xmlns: ASP = "http://schemas.microsoft.com/ASPNET/20"
Xmlns: _ designer = "http: schemas.microsoft.com/webparts/v2/dataview/designer"
Xmlns: SharePoint = "Microsoft. Sharepoint. webcontrols"
>
<Table border = "0" width = "100%" cellpadding = "5" cellspacing = "0">
<Tr valign = "TOP">
<TH class = "MS-Vl" nowrap = ""> query start date: </Th>
<TH class = "MS-ku" nowrap = "">
<SharePoint: datetimecontrol runat = "server" id = "datetimecontrol1"
Dateonly = "true" localeid = "2052" selecteddate = "{$ pstartdate}"/> </Th>
<TH class = "MS-Vl" nowrap = ""> query end date: </Th>
<TH class = "MS-ku" nowrap = "">
<SharePoint: datetimecontrol runat = "server" id = "datetimecontrol2"
Dateonly = "true" localeid = "2052" selecteddate = "{$ penddate}"/> </Th>
<TH class = "MS-ku" nowrap = "">
<SCRIPT type = "text/JavaScript">
Function postdateback (){
VaR vcalenderdate = Document. getelementbyid (g_strdatetimecontrolids
["Datetimecontrol1"]);
VaR vstr1 = vcalenderdate. value;
Vstr1 = vstr1.replace (// G ,"-");
VaR vdate = Document. getelementbyid (g_strdatetimecontrolids
["Datetimecontrol2"]);
VaR vstr2 = vdate. value;
Vstr2 = vstr2.replace (// G ,"-");
VaR TargetUrl = removequeryparameterfromurl (window. Location. href, "calendardate ");
TargetUrl = removequeryparameterfromurl (window. Location. href, "date ");
TargetUrl = sturlsetvar2 (TargetUrl, "calendardate", vstr1 );
TargetUrl = TargetUrl + "& amp; Date =" + vstr2;
Window. Location. href = TargetUrl;
}
</SCRIPT> <input name = "button1" type = "button" value = "query" onclick = "postdateback ();"/>
Finally, we will see:
Then, you can set filtering conditions for the list.
In addition, if you add a calendar control to the page (add this line to the Code)
<SharePoint: spdatepickercontrol id = "dpc1" runat = "server" langid = "2052" localeid = "2052"/>)
Click the calendar control twice, select two dates, and click the start query button above to achieve the same effect.
Code testing is successful.