StrataFrame Forum

Browse Dialog Results grid

http://forum.strataframe.net/Topic29587.aspx

By Ross L. Rooker, Sr. - 2/18/2011

When the rowpopulating event occurs I need to get a reference to enumerate through the cells on each row and look at the cell values. If I find the word "INACTIVE" in any of the cells, I want to turn that line RED. If I find a cell value of "1/1/1800' I want to display an empty value in that cell. Can you give me a sample on how to do this? I have done it with the regular .NET grid and the Infragistics grid.
By Edhy Rijo - 2/18/2011

Hi Ross,
In the RowPopulating event of the Browse Dialog, add code as the one below to handle your situation.  It is basically the same as in the regular SF listview, the key is to cast or DirectCast the e.BusinessObject argument to get to the listview data.

        Private Sub FirstUseImportBrowseDialog_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgsHandles MyBase.RowPopulating
            Using loBO As bizBrowseDialogForTransaction_View = DirectCast(e.BusinessObject, bizBrowseDialogForTransaction_View)
                With loBO
                    If .ReceivedOn = "1/1/1800" Then
                        e.Values(0).DisplayValue = String.Empty
                    Else
                        e.Values(0).DisplayValue = .ReceivedOn.ToString("dd-MMM-yyyy")
                    End If

                    If .FU_CarrierInvoiceDate = "1/1/1800" Then
                        e.Values(3).DisplayValue = String.Empty
                    Else
                        e.Values(3).DisplayValue = .FU_CarrierInvoiceDate.ToString("dd-MMM-yyyy")
                    End If

                    '-- Show incompleted process in red.
                    If .FU_TotalRecordsCount > .FU_TotalImportedCount Then
                        e.Values(6).DisplayValue = (.FU_TotalRecordsCount - .FU_TotalImportedCount).ToString("n0")
                        e.RowForeColor = Drawing.Color.Red
                    End If
                End With
            End Using
        End Sub

By Ross L. Rooker, Sr. - 2/18/2011

I am not a VB programmer. I converted the above to C# but getting an error on the highlighted line below on the BO.

loBO ) expected

e.BusinessObject  only assignment, call, increment, decrement and new object expressions can be used as a statement

private void browseDialog1_RowPopulating(MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs e)

{

using (this.tbl_BillTerms_1 loBO = (this.tbl_BillTerms_1)e.BusinessObject)

{

var _with1 = loBO;

if (_with1.ReceivedOn == "1/1/1800")

{

e.Values[0].DisplayValue =
string.Empty;

}

else

{

e.Values[0].DisplayValue = _with1.ReceivedOn.ToString(
"dd-MMM-yyyy");

}

if (_with1.FU_CarrierInvoiceDate == "1/1/1800")

{

e.Values[3].DisplayValue =
string.Empty;

}

else

{

e.Values[3].DisplayValue = _with1.FU_CarrierInvoiceDate.ToString(
"dd-MMM-yyyy");

}

//-- Show incompleted process in red.

if (_with1.FU_TotalRecordsCount > _with1.FU_TotalImportedCount)

{

e.Values[6].DisplayValue = (_with1.FU_TotalRecordsCount - _with1.FU_TotalImportedCount).ToString(
"n0");

e.RowForeColor = System.Drawing.
Color.Red;

}

}

}

By Edhy Rijo - 2/18/2011

Ross L. Rooker, Sr. (2/18/2011)
I am not a VB programmer. I converted the above to C# but getting an error on the highlighted line below on the BO.

Well don't worry, I am not a C# developer either w00t
I don't know if the Using/End using command exist in C# but basically you are just creating a new object "loBO" or whatever name you want to use of type of your business object and assigning the value of e.BusinessObject so you can use the data in the list for your validation.

I am sure somebody with C#/VB experience will jump in to give you the correct code or you can look at the SF C# samples which may have similar coding.
By Ross L. Rooker, Sr. - 2/18/2011

I found out what was wrong. Thanks.
By Edhy Rijo - 2/18/2011

Ross L. Rooker, Sr. (2/18/2011)
I found out what was wrong. Thanks.

You are welcome Ross.

Could you please post what was wrong and the fix you used?
By Ross L. Rooker, Sr. - 2/22/2011

The code below is what I used to color certain rows based on the value of a row column and the lines commented out would take care of any values that were 1/1/1800 is they were being displayed.

private void browseDialog1_RowPopulating(MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs e)

{

TrustedVALET_BO.
tbl_BillTerms_1 loBO = (TrustedVALET_BO.tbl_BillTerms_1)e.BusinessObject;

if (loBO.BILLTERMS_RSTATUS == "INACTIVE")

{

e.RowForeColor = System.Drawing.
Color.Red;

}

//if (loBO.BILLTERMS_ENTDT.ToString() == "1/1/1800 12:00:00 AM")

//{

// e.Values[0].DisplayValue = string.Empty;

//}

//else

//{

// e.Values[0].DisplayValue = loBO.BILLTERMS_ENTDT.ToString("dd-MMM-yyyy");

//}

}

}

By Edhy Rijo - 2/22/2011

Thanks Ross,  glad you figured out.