in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

kwanl's blog

May 2007 - Posts

  • Datagrid not retaining viewstate on postback

    I haven't done much DataGrid programming in the past but it's used quite a bit at my new job. I thought I was pretty proficient at ASP.Net 1.1 but I was having some trouble getting the DataGrid viewstate to work. The problem was when you have AutoGenerateColumns set to false you have to do a little bit of extra work for the viewstate to load, you need to set up the columns on each page load.

    http://www.velocityreviews.com/forums/t111954-net-datagrid-contents-lost-on-postback.html

  • Writing a Rendering Extension for Reporting Services 2005

    One glaring omission from the out-of-the-box SSRS 2005 output formats is plain text ASCII. I know there is a CSV option available but CSV is primarily used for data-interchange. My goal was to create a custom rendering extension to output reporting services reports as attractive as possible in plain text ASCII.

    Conceptually, the process is simple, you provide a class that implements the Microsoft.ReportingServices.ReportRendering.IRenderingExtension interface and add an entry to the rsreportserver.config file for your assembly.

     

    Implementing IRenderingExtension

    The IRenderingExtension interface is really straight-forward and there are only a few methods you have to implement with Render and RenderStream being the most important (and challenging).

    Modifying rsreportserver.config 

    The rsreportserver.config file controls various settings for the Report Server including which extensions are available. To add a rendering extension, you add a new Extension element under the Extensions/Render element.

    For example, this adds an extension for a rendering extension name SimpleRenderer.Class1 in the assembly SimpleRenderer.dll. 

     <Extension Name="Kwan" Type="SimpleRenderer.Class1,SimpleRenderer" Visible="true" /> 

    In addition to modifying the configuration file you need to make sure your assembly is fully trusted. This is because the classes in Microsoft.ReportingServices.ReportRendering only support fully trusted callers. There are several ways to do this but the preferred method is to update the policy file to give your specific assembly full trust.

     

    Add the following to your rssrvpolicy.config (specifying the public key blob for your assembly):

                                <CodeGroup
                                        class="UnionCodeGroup"
                                        version="1"
                                        PermissionSetName="FullTrust"
                                        Name="SimpleRenderer_Strong_Name"
                                        Description="This code group grants SimpleRenderer code full trust. ">
                                    <IMembershipCondition
                                            class="StrongNameMembershipCondition"
                                            version="1"
                                            PublicKeyBlob="..."
                                    />
                                </CodeGroup>
     


Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts