Progress Bar column: Value1, Value2 and Maximum

4 posts, 0 answers
  1. Jose
    Jose avatar
    8 posts
    Member since:
    Jun 2019

    Posted 03 Sep 2019 Link to this post

    Hello.

    I've made a progress bar column like it's explained in your documentation: https://docs.telerik.com/devtools/winforms/controls/gridview/cells/creating-custom-cells

    Protected Overrides Sub SetContentCore(ByVal value As Object)

    If Me.Value IsNot Nothing AndAlso Me.Value IsNot DBNull.Value Then

    Me.radProgressBarElement.Value1 = Convert.ToInt16(Me.Value)

    End If

    End Sub

     

    how can i set the value2 of the progressbar?

    and i'd like could modify the maximum value.

    i've found:

     

    protected override void CreateChildElements()
    {
        base.CreateChildElements();

        radProgressBarElement = new RadProgressBarElement();
        radProgressBarElement.Minimum = 0;
        radProgressBarElement.Maximum = 10;
        this.Children.Add(radProgressBarElement);
    }

     

    but in this case the maximum it's diferent in each row of the grid (it is defined by an other field -column- )

     

    would be it possible??

     

    thx very mucht

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3958 posts

    Posted 04 Sep 2019 Link to this post

    Hello, Jose,    

    Note that the CreateChildElements method is fired just once for the cell element when creating. Due to the UI virtualization in RadGridView, cell elements are created only for currently visible cells and are being reused during operations like scrolling, filtering, grouping and so on. The appropriate place to synchronize the value of the progress bar with the value of the cell is the SetContentCore method. Thus, you can access the data row to which the cell element is currently associated and determine what settings to apply to the RadProgressBarElement, e.g. Maximum

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

     

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Jose
    Jose avatar
    8 posts
    Member since:
    Jun 2019

    Posted 05 Sep 2019 Link to this post

    Thx for your Answer.

    I don't understand how to pass two different values to the setcontentcore, for example value1 and maximum of the progressbar.

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3958 posts

    Posted 06 Sep 2019 Link to this post

    Hello, Jose,    

    Following the help article for creating custom cells in RadGridView, I have prepared a sample project for your reference, where in the SetContentCore method, a different maximum is specified for the RadProgressBarElement

                protected override void SetContentCore(object value)
                {
                    if (this.Value != null && this.Value != DBNull.Value)
                    {
                        if (this.RowIndex % 2 == 0)
                        {
                            this.radProgressBarElement.Maximum = 100;
                        }
                        else
                        {
                            this.radProgressBarElement.Maximum = 50;
                        }
                        this.radProgressBarElement.Value1 = Convert.ToInt16(this.Value);
                    }
                }

    The following screenshot demonstrates how the cells illustrates the same value with the different maximum:

    I hope this information helps. If you need any further assistance please don't hesitate to contact me.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top