I've two method that are the code from here http://www.rajbandi.net/fixing-ssrs-report-viewer-control-date-picker-in-google-chrome/#comment-988 , Then i apply the following code to my project i have a problem.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Reporting.WebForms;
using System.Configuration;
using System.Web.SessionState;
using RLISDev.Models;
using RLISDev.BaseObjects;
using System.Web.Mvc;
using RLISDev.Extensions;
using RLISDev.Annotations;
using System.Collections;
protected override void OnPreRender(EventArgs e) {
base.OnPreRender(e);
DatePicker1.Value = string.Join(",", (new > List(GetDateParameters()).ToArray()));
}
private IEnumerable GetDateParameters() {
// I'm assuming report view control id
// as reportViewer
foreach(ReportParameterInfo info in
ReportViewer1.ServerReport.GetParameters()) {
if (info.DataType ==
ParameterDataType.DateTime) {
yield
return string.Format("[{0}]",
info.Prompt);
}
}
}
And I got error here
List(GetDateParameters()).ToArray()) Using the generic type 'System.Collections.Generic.List' requires 1 type arguments
I am not sure what i am missing.
You have to give it a type argument, as it is a generic class:
var test = new List<DateTime>();
Depending on the return type of GetDateParameters()
; you want something like:
DatePicker1.Value = string.Join(",", (new List<DateTime>(GetDateParameters()).ToArray()));
Note : i am modified my code
protected override void OnPreRender(EventArgs e) {
base.OnPreRender(e);
DatePicker1.Value = string.Join(",", (GetDateParameters().ToList().ToArray()));
}
private IEnumerable < string > GetDateParameters() {
// I'm assuming report view control id as reportViewer
foreach(ReportParameterInfo info in ReportViewer1.ServerReport.GetParameters()) {
if (info.DataType == ParameterDataType.DateTime) {
yield return string.Format("[{0}]", info.Prompt);
}
}
}
and this is worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.