를보고 난 내 결정 모든 보고서를 표시하는 페이지가 아래 그림대로 :프로그래밍 변경 하이퍼 링크 URL은 영문 페이지
이 보고서는 가지고 (슬프게도, 하드 코딩) 포인트 https://myserver.bla.bla 그들에 URL 공식을 예 해당
어떻게 든 프로그래밍 방식으로 URL의 인스턴스를 찾고 다른 것으로 변경하고 싶습니다. (이 보고서가 수백 개이고 모든 링크를 이동하고 변경할 충분한 시간이 없습니다.)
저는 FieldObjects를 둘러 보았지만 형식 지정 수식을 변경하는 방법을 알 수 없었습니다. reportdocument.fieldformulas를 보면 url 서식 지정 수식이 없습니다.
공공 부분 클래스 보고서 : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e)
{
iLogger logger = LoggingFactory.CreateLogger();
ReportDocument rd = new ReportDocument();
string fileName = Request.QueryString["reportfile"];
if(!Regex.IsMatch(fileName,@"^[ 0-9a-zA-Z-_\\]+.rpt$"))
{
ArgumentException aex = new ArgumentException("Invalid file/path specified.");
logger.LogError(ActionTypes.Administration, HttpContext.Current.User.Identity.Name,
"Passed invalid file path to report viewer: " + fileName, aex);
throw aex;
}
if(Path.IsPathRooted(fileName))
{
ArgumentException aex = new ArgumentException("Absolute path passed to report viewer.");
logger.LogError(ActionTypes.Administration, HttpContext.Current.User.Identity.Name,
"Passed invalid file path to report viewer: " + fileName, aex);
throw aex;
}
string rootPath = Server.MapPath("~/Reports/");
string path = Path.Combine(rootPath, fileName);
if (File.Exists(path))
{
rd.Load(path);
}
//get all keys starting with Prompt
var prompts = Request.QueryString.AllKeys.Where(q => q.StartsWith("Prompt"));
foreach (string promptKey in prompts)
{
//try to convert the rest of the string to an int
//yes, this should probably not just be a replace here...
string withoutPrompt = promptKey.Replace("Prompt", "");
int promptVal;
if (int.TryParse(withoutPrompt, out promptVal))
{
rd.SetParameterValue(promptVal, Request.QueryString[promptKey]);
}
//rd.SetParameterValue(promptKey, Request.QueryString[promptKey]);
CrystalReportViewer1.ReportSource = rd;
}
}
가치가있는 경우 렌더링 된 후에 클라이언트 페이지에서이 값을 변경하는 것이 좋습니다 (예 : 자바 스크립트에서 URL을 변경하는 것). 그런 식으로 하위 보고서를로드하는 등의 방법으로도로드 할 수 있습니다. – Yablargo