Problem with ASP.NET ReportViewer

Discussion in 'ASP .Net Web Controls' started by Chris Cap, Feb 1, 2007.

  1. Chris Cap

    Chris Cap Guest

    We are currently using client reports (.rdlc) to serve up some reports for
    our clients. We are trying to make it so that when a user clicks on category
    data (ie - order number), it will navigate to a new page that shows the order
    details with the order id in the querystring. I tried clicking on the data
    point and then chosing action and setting the radio button to "Jump to URL",
    but it only works with an absolute path (http://www.google.com) it won't work
    with relative links (/orderHistory.aspx).

    Does anyone know how I can get this to work. I tried using
    Globals!ReportServerUrl to get the absolute path, but that doesn't render
    anything in a local report apparently. I was thinking of adding a reference
    to a custom assembly that pulled a value from my web.config, however,
    references don't seem to work unless the assembly is in the GAC which is not
    an option.

    I would really prefer not to hardcode the absolute path. I need to be able
    to change what server this is hosted on and what domain name it uses very
    easily. I don't think the control exposes a Hyperlink_NAvigate event like
    the winforms version of this control does. Any help is appreciated.
     
    Chris Cap, Feb 1, 2007
    #1
    1. Advertising

  2. Hello Chris,

    Based on your description, you have an RDLC client report which want to
    programmaticaly construct a url string(full qualified one such as
    Http://servername/appname/page...) and use it in your reportitem
    expression, correct?

    I think your current idea about put the main url part in application's
    config file and read it through custom assembly's code is a good idea. And
    I have another idea which also rely on custom code/assembly. You can use
    the HttpContext.Request.Url to get the absolute url information e.g.

    the following class/method can help return the url to the current
    application's virtual dir

    =========================
    namespace ReportLib
    {
    public class ReportUtil
    {
    public static string GetUrl()
    {
    string url =
    System.Web.HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority)
    ;
    url += System.Web.HttpContext.Current.Request.ApplicationPath;


    return url;
    }
    }
    }
    ==================


    For the custom assembly, of course you do not have to put it in GAC. A
    simple private assembly in ASP.NET application's "bin" dir is necessary.
    The problem you met may be caused by the custom assembly or any other
    assembly you used is not trusted, to make any custom assembly you use in
    your local report(RDLC) trusted, you can use the following like code in
    page's load event.

    ===========
    protected void Page_Load(object sender, EventArgs e)
    {

    this.ReportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Repor
    tLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");


    }
    =============

    "ReportLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" is the
    assembly name of my custom assembly. Here is a good blog article describe
    the detailed on how to use custom code/assembly in RDLC local report.


    #Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &
    Solutions)
    http://blogs.msdn.com/mohamed_sharafs_blog/archive/2005/12/20/LocalReportCus
    tomCode.aspx

    Hope this helps.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Feb 2, 2007
    #2
    1. Advertising

  3. Chris Cap

    Chris Cap Guest

    Thanks Steven. I will give that at try

    "Steven Cheng[MSFT]" wrote:

    > Hello Chris,
    >
    > Based on your description, you have an RDLC client report which want to
    > programmaticaly construct a url string(full qualified one such as
    > Http://servername/appname/page...) and use it in your reportitem
    > expression, correct?
    >
    > I think your current idea about put the main url part in application's
    > config file and read it through custom assembly's code is a good idea. And
    > I have another idea which also rely on custom code/assembly. You can use
    > the HttpContext.Request.Url to get the absolute url information e.g.
    >
    > the following class/method can help return the url to the current
    > application's virtual dir
    >
    > =========================
    > namespace ReportLib
    > {
    > public class ReportUtil
    > {
    > public static string GetUrl()
    > {
    > string url =
    > System.Web.HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority)
    > ;
    > url += System.Web.HttpContext.Current.Request.ApplicationPath;
    >
    >
    > return url;
    > }
    > }
    > }
    > ==================
    >
    >
    > For the custom assembly, of course you do not have to put it in GAC. A
    > simple private assembly in ASP.NET application's "bin" dir is necessary.
    > The problem you met may be caused by the custom assembly or any other
    > assembly you used is not trusted, to make any custom assembly you use in
    > your local report(RDLC) trusted, you can use the following like code in
    > page's load event.
    >
    > ===========
    > protected void Page_Load(object sender, EventArgs e)
    > {
    >
    > this.ReportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Repor
    > tLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
    >
    >
    > }
    > =============
    >
    > "ReportLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" is the
    > assembly name of my custom assembly. Here is a good blog article describe
    > the detailed on how to use custom code/assembly in RDLC local report.
    >
    >
    > #Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &
    > Solutions)
    > http://blogs.msdn.com/mohamed_sharafs_blog/archive/2005/12/20/LocalReportCus
    > tomCode.aspx
    >
    > Hope this helps.
    >
    > Sincerely,
    >
    > Steven Cheng
    >
    > Microsoft MSDN Online Support Lead
    >
    >
    >
    > ==================================================
    >
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications.
    >
    >
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    >
    > ==================================================
    >
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >
    >
     
    Chris Cap, Feb 2, 2007
    #3
  4. Thanks for the reply Chris,

    Please feel free to let me know if you have got any progress or there is
    anything else we can help.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Feb 5, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TmVvZHluYW1pYw==?=

    How to add barcode images into ASP.NET ReportViewer - RDLC reports

    =?Utf-8?B?TmVvZHluYW1pYw==?=, Nov 23, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,593
    Juan T. Llibre
    Nov 23, 2005
  2. gotzonen

    ReportViewer en ASP.NET 2.0

    gotzonen, May 2, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    5,785
    Mark Rae
    May 2, 2006
  3. Replies:
    0
    Views:
    425
  4. =?Utf-8?B?VG9tIERhbHNpbWVy?=

    Reportviewer drill-through problem in asp.net 2.0

    =?Utf-8?B?VG9tIERhbHNpbWVy?=, Jun 21, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    971
    =?Utf-8?B?VG9tIERhbHNpbWVy?=
    Jun 21, 2007
  5. Replies:
    0
    Views:
    820
Loading...

Share This Page