Upgraded to the latest version doesn't show textbox data that comes from ItemDataBinding

19 posts, 0 answers
  1. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 28 Oct Link to this post

    Hello,

    I have upgraded to latest version of Telerik Reporting and the upgrade looks fine but it doesn't show textbox values that are created dynamically using DataBinding. Please can any one help what the issue was?

    Thanks.
  2. Katia
    Admin
    Katia avatar
    309 posts

    Posted 31 Oct Link to this post

    Hi Krishna,

    As of R3 2016, in events you can access and modify only the processing elements. Any changes applied to the report definition or its items in events will not be applied.
    For more detailed information you can refer to the following resources:

    Regards,
    Katia
    Telerik by Progress
    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
  3. DevCraft banner
  4. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 31 Oct in reply to Katia Link to this post

    Hello Katia,

     

    Thank you for your response. I did not get your answer properly. Can you please elaborate more?

    Here is the sample code that I am trying to bind.

     

     public void Report_ItemDataBinding(object sender, EventArgs e)
            {           
                this.textBox2.Value = ReportHelper.GetAccountID(ReportParameters["AccountID"].Value);

    }

    My final report doesn't show any value in that textbox2. And the same code was working before upgrading to R3 2016.

  5. Katia
    Admin
    Katia avatar
    309 posts

    Posted 31 Oct Link to this post

    Hello Krishna,

    In your scenario, it might be easier to set the value of the TextBox to an expression that uses a custom function, for example: = ReportHelper.GetAccountID(Parameters.AccountID.Value).

    Otherwise, to set the TetxBox's value inside the event handler you need to use the processing TextBox, for example:
    private void detail_ItemDataBinding(object sender, EventArgs e)
    {
        Telerik.Reporting.Processing.DetailSection section = (sender as Telerik.Reporting.Processing.DetailSection);
        Telerik.Reporting.Processing.TextBox txt = (Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(section, "textBox1");
        txt.Value = "new value";
    }
    More information can be found in Understanding Events help article.


    Regards,
    Katia
    Telerik by Progress
    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
  6. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 31 Oct in reply to Katia Link to this post

    Thanks for the response. But my textbox is in pageHeaderSection1, Can I know how to bind the data with it.

    I am trying in this way but, it didn't work for me.When I was debugging I get the null data into pageHeader. Can you please let me know what's wrong with my code.

      private void pageHeaderSection1_ItemDataBinding(object sender, EventArgs e)
            {
                Telerik.Reporting.Processing.PageSection pageHeader = sender as Telerik.Reporting.Processing.PageSection;
                Telerik.Reporting.Processing.TextBox txt =(Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(pageHeader, "textBox2");

     txt.Value=Convert.ToDateTime(ReportParameters["FromDate"].Value);

     }

     

     

  7. Katia
    Admin
    Katia avatar
    309 posts

    Posted 01 Nov Link to this post

    Hi Krishna,

    The code you provided works as expected on our side, see the attached report.

    Note, that the above scenario can be achieved without the usage of events. Instead, you can set the value of the textBox to the expression. Expressions can contain parameter values, built-in functions and custom functions.


    Regards,
    Katia
    Telerik by Progress
    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
  8. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 01 Nov in reply to Katia Link to this post

    I got it. And it is working fine for me now. Thank you so much.

    In our last version, we were binding all textbox values from pageHeader,pageFooter and Report backgrounds from single ItemDataBinding event. Which works fine at that time.

    Now we have to seperate ItemDatabinding events to pageHeader,pageFooter etc..

    Can I know the reason why it is not working in Latest Version? Did you change any architecture?

    Please check the below sample code from my previous version.

    In the below Sample code textbox18 is from pageHeader and textbox26 is from pageFooter and also we are changing the report header logo. Also attaching sample designer in text file to show where I was calling this BindingEvent.

    Report.cs

    private void Report_ItemDataBinding(object sender, EventArgs e)
    {
    textBox18.Value = textBox26.Value =
    Convert.ToDateTime(ReportParameters["FromDate"].Value);

                if (logo() == "abc")
                {
                    this.reportHeader.Style.BackgroundImage.ImageData =
                        Images.abc_logo;
                }
                else
                {
                    this.reportHeader.Style.BackgroundImage.ImageData =Images.logo2;

    }

    }

    Report.designer.cs

     

    ?

    // 
                // pageFooter
                // 
                this.pageFooter.Height = Telerik.Reporting.Drawing.Unit.Inch(0.42916667461395264D);
                this.pageFooter.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
                this.textBox17,
                this.textBox18,
                this.textBox19,
                this.tbFooterReportId});
                this.pageFooter.Name = "pageFooter";

     // 
                // pageHeaderSection1
                // 
                this.pageHeaderSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(1.3000000715255737D);
                this.pageHeaderSection1.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {

                this.titleTextBox,
                this.textBox26});

                 this.pageHeaderSection1.Name = "pageHeaderSection1";

     // 
                // Report1
                // 
                group1.GroupFooter = this.groupFooterSection;
                group1.GroupHeader = this.groupHeaderSection;
                group1.Name = "group";
                this.Groups.AddRange(new Telerik.Reporting.Group[] {
                group1});
                this.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
                this.groupHeaderSection,
                this.groupFooterSection,
                this.pageHeaderSection1,
                this.detail,
                this.pageFooterSection1});
                this.Name = "Report1";
                this.PageSettings.Margins = new Telerik.Reporting.Drawing.MarginsU(Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(1D));
                this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Letter;
                reportParameter1.Name = "FromDate";
                reportParameter1.Type = Telerik.Reporting.ReportParameterType.DateTime;
                reportParameter1.Value = "= Today()";
                reportParameter1.Visible = true;
                this.ReportParameters.Add(reportParameter1);
                styleRule1.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {
                new Telerik.Reporting.Drawing.StyleSelector("Heading1")});
                styleRule1.Style.Font.Bold = true;
                styleRule1.Style.Font.Italic = true;
                styleRule1.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(20D);
                this.StyleSheet.AddRange(new Telerik.Reporting.Drawing.StyleRule[] {
                styleRule1});
                this.Width = Telerik.Reporting.Drawing.Unit.Inch(6D);
                 this.ItemDataBinding += new System.EventHandler(this.Report_ItemDataBinding);
                ((System.ComponentModel.ISupportInitialize)(this)).EndInit();

     

     

  9. Katia
    Admin
    Katia avatar
    309 posts

    Posted 01 Nov Link to this post

    Hi Krishna,

    In versions prior to R3 2016, all changes in events were accepted, even these applied on items' definitions. This was changed in R3 2016 due to the optimizations in the processing and how item definitions' properties are read and stored.

    For more details check:

    Regards,
    Katia
    Telerik by Progress
    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
  10. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 01 Nov in reply to Katia Link to this post

    Got it. Thanks a lot for all your answers.
  11. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 01 Nov in reply to Katia Link to this post

    Katia,

    I am applying the above mentioned ItemDatabinding to several reports. Some of the reports works fine but some doesn't show data in pageHeaderSection. Am I missing anything? 

     

    And for some reports I am giving data manually for example textbox1.value= Titleabc and I am binding it to the PageHeaderSection which doesn't display any data. Please let me know if I am doing anything wrong.

  12. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 01 Nov in reply to Katia Link to this post

    Katia,

    I am applying similar ItemDataBinding to several reports according to the code you posted. but some of them work fine and some of them are not showing any data in pageHeaderSection1.

    And for some reports , I am giving the pageHeader title in the textbox value manually. for Example, textbox1.value = Titleabc. It doesn't show the title in the pageHeaderSection when I run my report. Am I missing anything? Please let me know.

  13. Katia
    Admin
    Katia avatar
    309 posts

    Posted 02 Nov Link to this post

    Hello Krishna,

    I am not certain about the exact scenario, the structure of the report and the full customizations you apply to the report.

    If you are working with item definition (textbox1.value = Titleabc) inside the event handler the changes will not be applied - Changes on items in report events are not applied. Thus, you need to check if you are working with processing item.


    Regards,
    Katia
    Telerik by Progress
    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
  14. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 18 Nov in reply to Katia Link to this post

    Hi,

     

    I have a PageHeaderSection and GroupHeaderSection.

    I need to display PageHeaderSection when no records present and display GroupheaderSection when there are records.

    It works fine. but, I get the whitespace for the PageHeaderSection when I want to display records which doesn't look good. Is there any solution to hide the whitespace? Please let me know.

     

    Thanks

  15. Katia
    Admin
    Katia avatar
    309 posts

    Posted 21 Nov Link to this post

    Hi Krishna,

    This behavior is expected for the page sections. The space taken up by PageHeader or PageFooter sections would always be reserved no matter whether they are visible or not - Understanding Rendering Behaviors(Page Header and Footer sections).

    In upcoming R1 2017 release, we plan to change this behavior and to add the ability for the page sections to be collapsed when hidden - Roadmap for R1 2017.


    Regards,
    Katia
    Telerik by Progress
    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
  16. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 21 Nov in reply to Katia Link to this post

    Thanks for the response.

     

    I have below scenario.

     

     // 
                // reportHeader
                // 
                this.reportHeader.Height = Telerik.Reporting.Drawing.Unit.Inch(1.25D);
                this.reportHeader.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
                this.titleTextBox,
                this.textBox26});
                this.reportHeader.Name = "reportHeader";
                this.reportHeader.Style.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(144)))), ((int)(((byte)(171)))), ((int)(((byte)(199)))));
                this.reportHeader.Style.BackgroundImage.MimeType = "image/png";
                this.reportHeader.Style.BackgroundImage.Repeat = Telerik.Reporting.Drawing.BackgroundRepeat.NoRepeat;
                this.reportHeader.ItemDataBinding += new System.EventHandler(this.reportHeader_ItemDataBinding);

    // 
                // textBox26
                // 
                this.textBox26.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.02083333395421505D), Telerik.Reporting.Drawing.Unit.Inch(0.77920609712600708D));
                this.textBox26.Name = "textBox26";
                this.textBox26.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(8.5624618530273438D), Telerik.Reporting.Drawing.Unit.Inch(0.47071495652198792D));
                this.textBox26.Style.Font.Name = "Arial";
                this.textBox26.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(10D);
                this.textBox26.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left;
                this.textBox26.StyleName = "RHeader_ParmText";
                this.textBox26.Value = "";

    This is my code

     

    private void reportHeader_ItemDataBinding(object sender, EventArgs e)
    {
                // Set account name in page header/footer
                Telerik.Reporting.Processing.ReportSection reportHeader = sender as Telerik.Reporting.Processing.ReportSection;
                Telerik.Reporting.Processing.TextBox txt26 = (Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(reportHeader, "textBox26");
                txt26.Value =
                ReportHelper.GetAccountNames(ReportParameters["AccountID"].Value);               
            
            }

     

    I am not able to see Textbox26 value on my report header when I run my final report. I couldn't figure out what's wrong with this.

    Please let me know.

     

    Thanks

  17. Katia
    Admin
    Katia avatar
    309 posts

    Posted 21 Nov Link to this post

    Hi Krishna,

    Inside the event handlers, you can work only with processing items. This applies to report parameters as well. An example of how to get the processing report parameter is provided here.

    To reach the outer container you can use ProcessingElement.ParentElement property.


    Regards,
    Katia
    Telerik by Progress
    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
  18. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 21 Nov in reply to Katia Link to this post

    I am still facing the same issue. When I debug this I wam able to see the data for txt26.value. But, it is not displaying in my final result.

    Can you please provide any example ?

      private void reportHeader_ItemDataBinding(object sender, EventArgs e)
    {
               Telerik.Reporting.Processing.ReportSection reportHeader = sender as Telerik.Reporting.Processing.ReportSection;
               Telerik.Reporting.Processing.TextBox txt26 = (Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(reportHeader, "textBox26");
               txt26.Value =ReportHelper.GetAccountNames(reportHeader.Report.Parameters["AccountID"].Label);

            }

  19. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 21 Nov in reply to Katia Link to this post

    My report doesn't even display if I write my txt26.value as "abc". Please see the below code. I am not sure what's wrong with my code.

      private void reportHeader_ItemDataBinding(object sender, EventArgs e)
    {
               Telerik.Reporting.Processing.ReportSection reportHeader = sender as Telerik.Reporting.Processing.ReportSection;
               Telerik.Reporting.Processing.TextBox txt26 = (Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(reportHeader , "textBox26");
                txt26.Value = "abc";

    }

  20. krishna
    krishna avatar
    12 posts
    Member since:
    Sep 2014

    Posted 21 Nov in reply to Katia Link to this post

    Please ignore my last two posts. I got the solution. Thanks 
Back to Top
DevCraft banner