'string' a 'C1.C1Report.Section' 2025v2 399

Posted by: enrique.pv-ext on 12 May 2026, 6:52 am EST

    • Post Options:
    • Link

    Posted 12 May 2026, 6:52 am EST - Updated 12 May 2026, 6:57 am EST

    Hi,

    Migrate from 2010v1 to 2025v2 399 in ASP.NET WebForms NET Framework 4.8.1.

    Using C1ReportViewer from C1.Web.Wijmo.Controls.48.dll

    Changes C1WebReport to C1ReportViewer control.

    In VS2022 IDE, I get 'C1.C1Report.Section error message about convert string to ‘C1.C1Report.Section’

    report.Sections.Contains(“TIPO_Header”)

            //    if (this.C1GridView1.GroupedColumns.Count > 0)
            //    {
            //        C1WebReport.Report.Groups[0].GroupBy = ((C1BoundField)this.C1GridView1.GroupedColumns[0]).DataField;
            //        C1WebReport.Report.Groups[0].Sort = C1.C1Report.SortEnum.NoSort;
            //        C1WebReport.Report.Sections["TIPO_Header"].Fields["Field15"].Value = ((C1BoundField)this.C1GridView1.GroupedColumns[0]).DataField;
            //    }
            if (p.IsGrouped && !string.IsNullOrEmpty(p.GroupedFieldName))
            {
                report.Groups[0].GroupBy = p.GroupedFieldName;
                report.Groups[0].Sort = C1ReportV48.SortEnum.NoSort;
                if (report.Sections.Contains("TIPO_Header") &&
                    report.Sections["TIPO_Header"].Fields.Contains("Field15"))
                {
                    report.Sections["TIPO_Header"].Fields["Field15"].Value = p.GroupedFieldName;
                }
            }
         if (!string.IsNullOrEmpty(p.ChartImagePhysicalPath) &&
             //report.Sections.Contains("Detail") //&&
             report.Sections["Detail"].Fields.Contains("lblChart"))
         {
             report.Sections["Detail"].Fields["lblChart"].Picture = p.ChartImagePhysicalPath;
             report.Sections["Detail"].Fields["lblChart"].PictureAlign = C1ReportV48.PictureAlignEnum.CenterMiddle;
             report.Sections["Detail"].Fields["lblChart"].PictureScale = C1ReportV48.PictureScaleEnum.Scale;
         }

    any suggestions ? THANKS !! in advanced

  • Posted 13 May 2026, 3:22 am EST

    Hello Enrique,

    In newer version, Contains() only accepts a Section object, not a string. There’s no overload for string-based lookup.

    To resolve, create a helper extension method:

    public static class SectionCollectionExtensions
    {
        public static bool Contains(this C1.C1Report.SectionCollection sections, string name)
        {
            foreach (C1.C1Report.Section section in sections)
            {
                if (string.Equals(section.Name, name, StringComparison.OrdinalIgnoreCase))
                    return true;
            }
            return false;
        }
    }

    Then your existing code works without any changes.

    Here is a sample with the implementation. (see Report_Sample.zip)

    Regards,

    Uttkarsh.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels