Binding with a List<CustomObject> doesn't work - Why ?

2 posts, 0 answers
  1. Pierre
    Pierre avatar
    4 posts
    Member since:
    Apr 2016

    Posted 22 Jun Link to this post


    I try to bind an HtmlChart with a Custom List<> of object, like so:


    --------------------------- C#:

            protected void Page_Load(object sender, EventArgs e)

                RadHtmlChart_LineSeries_Avec_Objet.DataSource = oGetData();


            public class monObjet
                int ID { get; set; }
                decimal ValuePumpA { get; set; }
                decimal ValuePumpB { get; set; }
                decimal ValuePumpC { get; set; }
                decimal ValuePumpD { get; set; }

                public monObjet(int id, decimal VPumpA, decimal VPumpB, decimal VPumpC, decimal VPumpD)
                    ID = id;
                    ValuePumpA = VPumpA;
                    ValuePumpB = VPumpB;
                    ValuePumpC = VPumpC;
                    ValuePumpD = VPumpD;

            public List<monObjet> oGetData()
                List<monObjet> returnList = new List<monObjet>();
                for (int i = 0; i < 12; i++)
                    returnList.Add(new monObjet(i, i+1, i+2, i+3, i+4));
                return returnList;



    --------------------------- ASPX:

                   <telerik:RadHtmlChart runat="server" ID="RadHtmlChart_LineSeries_Avec_Objet" Width="1000px" Height="300px" ChartTitle-Text="HtmlChart sur List<objet>">
                                <telerik:LineSeries Name="Pump A" DataFieldY="ValuePumpA" ColorField="Yellow" >
                                    <LabelsAppearance Visible="false"/>

                                <telerik:LineSeries Name="Pump B" DataFieldY="ValuePumpB" ColorField="Green" >
                                    <LabelsAppearance Visible="false"/>

                                <telerik:LineSeries Name="Pump C" DataFieldY="ValuePumpC" ColorField="Red" >
                                    <LabelsAppearance Visible="false"/>

                                <telerik:LineSeries Name="Pump D" DataFieldY="ValuePumpD" ColorField="Black">
                                    <LineAppearance LineStyle="Smooth" Width="3" />
                                    <MarkersAppearance BackgroundColor="Red" MarkersType="Circle" Visible="true"/>
                                    <LabelsAppearance Visible="false"></LabelsAppearance>

                                <LabelsAppearance DataFormatString="{0}"></LabelsAppearance>

                                    <telerik:AxisItem LabelText="January"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="Februrary"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="March"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="April"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="May"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="June"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="July"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="August"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="September"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="October"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="November"></telerik:AxisItem>
                                    <telerik:AxisItem LabelText="December"></telerik:AxisItem>
                            <Appearance Visible="true"></Appearance>


    But that doesn't work.

    Why ?

    Thanks for your suggestions


  2. Pierre
    Pierre avatar
    4 posts
    Member since:
    Apr 2016

    Posted 22 Jun Link to this post


    I have found my error : All the properties of my public object must be declared public...

    I was thinking properties of an Public class was public, but no !






  3. DevCraft R3 2016 release webinar banner
Back to Top