I am new to Infragistics and web programming, I have a ASP.NET WHDG that has two columns that i want to use to set the value of a progress bar that is in the same row as the other two columns.
Column #1 contains what will be the max value of the progress bar
Column #2 contact what will be the current value of the progress bar.
How do i get the values of the two columns and then set the value of the progress bar for each row in the grid?
Any help would be greatly appreciated. I would like to do it in the code behind using vb.net
Hello Mike,
I'm glad that you managed to resolve your issue.
Thank you for choosing Infragistics!
Regards,Ivan Kitanov
Ivan...I was not referring to the correct column where the progress bar was located. It works now.
Do you get the exception by using the PreRender event and changing the values there as I suggested in the sample? Please note that index that is passed to the Items collection of the row should correspond to the cell you are trying to obtain the value of.
Is it possible to share a code snipped of the code that returns the NullReferenceException, so that I can investigate it?
Looking forward to your reply.
Regards, Ivan Kitanov
Hi Ivan.....thank you for your help. I am getting an 'Object reference not set to an instance of an object.' when trying to set the values to the progress bar
In order to assign value to the WebProgressBar based on another column, you would have to use a templated column inside the WebHierarchicalGrid and use the PreRender event of the grid to access the values of the columns in each row and assign these values to the Value and Maximum properties of the WebProgresBar. This could be achived with the following code:
Protected Sub WebHierarchicalDataGrid1_PreRender(ByVal sender As Object, ByVal e As EventArgs)
For i As Integer = 0 To Me.WebHierarchicalDataGrid1.Rows.Count - 1
Dim row As GridRecord = Me.WebHierarchicalDataGrid1.GridView.Rows(i)
Dim value As Double = CDbl(row.Items(3).Value)
Dim maximum As Double = CDbl(row.Items(4).Value)
Dim webProgressBar As WebProgressBar = TryCast(row.Items(5).FindControl("WebProgressBar1"), WebProgressBar)
webProgressBar.Value = value
webProgressBar.Maximum = maximum
Next
End Sub
Additionallty I am attaching a small sample that demonstrates what I have described above. Please let me know if you need any further assistance.
ProgressBarInsideCells.zip