This is a migrated thread and some comments may be shown as answers.

Progress Bar column: Value1, Value2 and Maximum

3 Answers 494 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jose
Top achievements
Rank 1
Jose asked on 03 Sep 2019, 11:11 AM

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

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Sep 2019, 01:21 PM
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.
0
Jose
Top achievements
Rank 1
answered on 05 Sep 2019, 09:26 AM

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.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Sep 2019, 07:29 AM

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.
Tags
GridView
Asked by
Jose
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Jose
Top achievements
Rank 1
Share this question
or