Setting size / position of PictureBox through function binding does not work in XML report definition / HTML 5 report viewer

6 posts, 0 answers
  1. Fridli Jacober
    Fridli Jacober avatar
    89 posts
    Member since:
    Dec 2009

    Posted 06 May 2015 Link to this post

    Hello

    Today I started designing my first report in the standalone report designer for the HTML 5 report viewer. Up to now, all reports were type definitions in a class library.

    We have some elements that need to be adjusted through bindings in respect of size or position according to the user's settings in the data base. This is done through global functions defined in the same reports class library. So I added the reports library as assembly reference for binding in XML reports for being able to use the same function bindings in the XML report as used in the report type definitions.
    So long so good. After having added this reference, binding works. For example assigning a value through such a bound function works as expected. Also the binding of functions for size and position doesn't throw an error. It just does nothing! the picture box stays where it's positioned in the report and keeps the size defined in the report. It drives me crazy!

    Function binding looks as follows:
    <Binding Path="Size" Expression="=ReportingLib.GlobalFunctions.setPictureSize(ReportingLib.GlobalFunctions.tryPath(Fields.Organisation_ID,&quot;ListHeaderPortrait&quot;))" />
                    <Binding Path="Location" Expression="=ReportingLib.GlobalFunctions.setLocation(Fields.Organisation_ListHeaderX, Fields.Organisation_ListHeaderY)" />
                    <Binding Path="Value" Expression="=ReportingLib.GlobalFunctions.tryPath(Fields.Organisation_ID,&quot;ListHeaderPortrait&quot;)" />

    As mentioned above, the Value binding works as expected but both Size and Location binding does nothing. The functions return Telerik drawing units:
            Return New Telerik.Reporting.Drawing.SizeU(New Telerik.Reporting.Drawing.Unit(width, Telerik.Reporting.Drawing.UnitType.Pixel), New Telerik.Reporting.Drawing.Unit(height, Telerik.Reporting.Drawing.UnitType.Pixel))
            Return New Telerik.Reporting.Drawing.PointU(New Telerik.Reporting.Drawing.Unit(x, Telerik.Reporting.Drawing.UnitType.Cm), New Telerik.Reporting.Drawing.Unit(y, Telerik.Reporting.Drawing.UnitType.Cm))

    Thanks for any help!


  2. Nasko
    Admin
    Nasko avatar
    1051 posts

    Posted 11 May 2015 Link to this post

    Hello Fridli,

    The referenced user functions in the TRDX report will start working properly after you add the following configuration to the web.config (app.config) file:
    <configuration>
      <configSections>
        <section
             name="Telerik.Reporting"
             type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting, Version=9.0.15.324, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
             allowLocation="true"
             allowDefinition="Everywhere"/>
      </configSections>
      <Telerik.Reporting>
            <AssemblyReferences>
                <add name="UserFunctions" version="1.0.0.0" culture="neutral" publicKeyToken="null" />
            </AssemblyReferences>
        </Telerik.Reporting>

    where UserFunctions is the name of the assembly containing the code.

    Regards,
    Nasko
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. Fridli Jacober
    Fridli Jacober avatar
    89 posts
    Member since:
    Dec 2009

    Posted 11 May 2015 in reply to Nasko Link to this post

    Hello Nasko

    As I've writen above, I've already done this and the function resolution and binding itself works. Too, the "Value" binding (path of the picture) works fine. But the "Size" and "Location" bindings don't work. No error message appears, the picture just keeps it's original position and size.

    The details about the function bindings and the data types are described in my first post.

    Regards

  4. Nasko
    Admin
    Nasko avatar
    1051 posts

    Posted 11 May 2015 Link to this post

    Hello Fridli,

    Please find attached a working sample project demonstrating the required configuration and Size/Location bindings.

    Regards,
    Nasko
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  5. Fridli Jacober
    Fridli Jacober avatar
    89 posts
    Member since:
    Dec 2009

    Posted 11 May 2015 in reply to Nasko Link to this post

    Hello Nasko

    Thanks for the example. It works, yes. I also tried using our functions in your example with a picture box which works too. Now when copying back the working picture box to our report in our web application, it doesn't work anymore (the binding reference to our assembly is the same in our web application and your example project).

    When I insert our functions in the value of a textbox with ToString() respectively Gettype().Tostring(), it says "Telerik.Reporting.Drawing.PointU" and "Telerik.Reporting.Drawing.SizeU" respectively "{X=3cm, Y=3cm}" and "{Width=87px, Height=95px}" which shows that the functions work.
    So any ideas what I may have missed? I don't know what could be different instead of the web.config and running one project in VS's IIS and the other in the normal ISS. BTW: I'm using Telerik Reporting ...422 while your project uses ...324.

    Regards

  6. Nasko
    Admin
    Nasko avatar
    1051 posts

    Posted 14 May 2015 Link to this post

    Hello Fridli,

    There might be something specific to your report and application which is preventing the bindings from working properly.
    Our suggestion is to post a new support ticket where you can attach a runnable sample project exhibiting the problematic behavior, so we can review it and advise further.

    Regards,
    Nasko
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top