我有两个主子报表ReportMain,ReportDetail,现在我通过ReportView控件来显示。当显示ReportMain的时候没有问题,可是当我一点ReportMain中的ID列,想跳到它所对应的ReportDetail上去,可此时就不是在ReportView控件中显示了,而是显示到http://localhost/ReportServer上了,请问这样的问题该如何解决。
 (注:ReportView控件是在一个框架页上的)。

解决方案 »

  1.   

    try add this HTML after <Head><base target="_self">
      

  2.   

    lyqof908(刘运祥)你所说得<base target="_self">
    是加到那里呢???
      

  3.   

    lyqof908(刘运祥) 我理解了你说得什么意思了,可是还是不可以大家还没有其他得建议呢??讨论讨论好了
      

  4.   

    不会吧,我今天还用主子报表做了,我根本没有用代码呀,就在Crystal Reports 10中间设计了子报表,只是设计了一个参数字段,结果是很好的嘛,没有什么问题呀。
      

  5.   

    你的Viewer是B/S结构的吧?而你的ID列是在Report里面在Report里面是写不了<base target = _self>的
      

  6.   

    这个问题我已经解决了,就是不知道你用的ReportView是微软提供的那个还是你自己写的,如果是微软的那个则需要验证,我没有太多研究,你可以自己开发ReportView,在处理子报表的时候把里面的连接偷偷换掉就可以了(如果有子报表的话,在生成的HTML代码里面都会有http://localhost/ReportServer连接的),把http://localhost/ReportServer替换成你WEB的地址就OK了,不管多少层报表都可以。
      

  7.   

    dbattn(胖子) 你可否 说的具体点呢?或者给点代码参考一下谢谢!
     wbj02(J^情之弦^J) 请问一下你的参数是如何传得呢?
      

  8.   

    因为涉及到公司版权问题,所以不好意思,不可以把整个控件的源代码给你!
    给你一些思路吧!
    你可以在控件里面,或者说你可以直接写成公用的CLASS都可以,reportingServices提供了一个Render的方法,用来得到报表的内容,返回值为byte[]数组,然后你可以用System.Text.Encoding.UTF8.GetString( 得到的byte[]数组 )方法转换为HTML格式的string,然后把里面对应的http://localhost/ReportServer/ReportService.asmx替换为你自己的web地址就可以了。
      

  9.   

    Render方法, 并没有返回值呀!
    protected override void Render(HtmlTextWriter output){}
    我怎么可以得到HTML格式的string
      

  10.   

    protected override void Render(HtmlTextWriter output)
    {
          StringWriter writer1 = new StringWriter();
          HtmlTextWriter writer2 = new HtmlTextWriter(writer1);
          base.Render(writer2);
          string text1 = writer1.ToString().Trim();      //此处可以修改呈现内容。      output.Write(text1);}
      

  11.   

    为什么总是提示""请求因 HTTP 状态 401 失败:Access Denied。""??
      

  12.   

    我的方法:
     protected override void Render(HtmlTextWriter output)
       {   
       if (this._serverUrl == String.Empty || this._reportPath == String.Empty)
       {
       output.Write("<P style=\"font-family: Verdana; font-size: 12px\">");
       output.Write("请在左边选择你要查看的报表。</P>");
       }
       else
       {
        // System.Text.Encoding.GetEncoding();
       // Create IFrame if the user enters ServerUrl and ReportPath
       Microsoft.Samples.ReportingServices.ReportingService.ReportingService rs =
       new Microsoft.Samples.ReportingServices.ReportingService.ReportingService();       byte[] result = null;
       string reportPath = this._reportPath;
       string format = "MHTML";
       string historyID = null;
       string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";    // Prepare report parameter.
       ParameterValue[] parameters = null;      DataSourceCredentials[] credentials = null;
       string showHideToggle = null;
       string encoding;
       string mimeType;
       Warning[] warnings = null;
       ParameterValue[] reportHistoryParameters = null;
       string[] streamIDs = null;
       SessionHeader sh = new SessionHeader();
       rs.SessionHeaderValue = sh;    try
       {
       result = rs.Render(reportPath, format, historyID, devInfo, parameters, credentials, 
       showHideToggle, out encoding, out mimeType, out reportHistoryParameters, out warnings,
       out streamIDs);    string strHtml = System.Text.Encoding.UTF8.GetString(result);
       }
       catch(System.Exception ex)
       {
       string str = ex.Message;
       throw ex;
       }
       output.WriteBeginTag("iframe");
       output.WriteAttribute("src", this.BuildUrlString());
       output.WriteAttribute("width", this.Width.ToString());
       output.WriteAttribute("height", this.Height.ToString());
       output.WriteAttribute("style", "border: 1 solid #C0C0C0");
       output.WriteAttribute("border", "0");
       output.WriteAttribute("frameborder", "0");
       output.Write(HtmlTextWriter.TagRightChar);
       output.WriteEndTag("iframe");  
       output.WriteLine();   
         
       }
    }
      

  13.   

    to houlinghouling(冰雪寒霜) 
    ??,什么情况下出现的?你看看是不是你参数带错了,比方说多了特殊字符之类
      

  14.   

    to dbattn(胖子) 
    参数好象没有你所说的多了特殊字符呀!
    在有需要添加datasource吗?
    reportPath 是完全路径吗?
      

  15.   

    reportPath的路径是记录在reportserver库中的路径,具体是那一个表我忘记了,有方法得到的。你自己去看一下帮助文档中reporting services programming这一章吧,里面什么都有了,包括SAMPLE