I am attempting to update the contents of some cells hen the row has focus and when it does not. I thought i could accomplish this by setting the cell value in those events. When i set the value i can see in code that it shows as updated but the grid never reflects the change. If I then go back to that row and look at the value it has reverted to what it was before i tried changing it. This is a bould grid that I have addd 2 unbound columns to. The unbound columns are formattedText
Private Sub grdResults_BeforeRowDeactivate(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles grdResults.BeforeRowDeactivate Dim activeRow As UltraGridRow = grdResults.ActiveRow Dim strDisplay As String Dim strNumberDisplay As String Dim strTypeDisplay As String
strDisplay = "<p><span style=""font-size: 12pt; line-height: 1.44; color: black;"">" + Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.EscapeXML(StrConv(CStr(activeRow.Cells("Name").Value), VbStrConv.ProperCase)) + "</span></p>"
strDisplay = strDisplay + " " + "<span style=""font-size: 10pt; line-height: 1.44; color: #666666;"">" + Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.EscapeXML(StrConv(activeRow.Cells("Address1").Value, VbStrConv.ProperCase)) + "</span>"
strDisplay = strDisplay.Replace(StrConv(_searchFileter, VbStrConv.ProperCase), "<b>" + StrConv(_searchFileter, VbStrConv.ProperCase) + "</b>")
strTypeDisplay = "" If activeRow.Cells("Status").Value = "A" Then strTypeDisplay = strTypeDisplay + GetImageTag(CsiImageResources.CsiImageList.Images(51), 16, 16, 3, 10) Else strTypeDisplay = strTypeDisplay + GetImageTag(CsiImageResources.CsiImageList.Images(53), 16, 16, 3, 10) End If
If activeRow.Cells("ResultType").Value = CentralSearchResultType.Customer Then strTypeDisplay = strTypeDisplay + GetImageTag(CsiImageResources.CsiImageList.Images(41), 16, 16, 3, 10) ElseIf activeRow.Cells("ResultType").Value = CentralSearchResultType.Vendor Then strTypeDisplay = strTypeDisplay + GetImageTag(CsiImageResources.CsiImageList.Images(45), 16, 16, 3, 10) Else strTypeDisplay = strTypeDisplay + GetImageTag(CsiImageResources.CsiImageList.Images(49), 16, 16, 3, 10) End If
strNumberDisplay = "<p align=""right""><span style=""font-size: 10pt; line-height: 1.44; color: #666666;"">#" + Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.EscapeXML(StrConv(activeRow.Cells("AccountNumber").Value, VbStrConv.ProperCase)) + "</span></p>" strNumberDisplay = strNumberDisplay.Replace(StrConv(_searchFileter, VbStrConv.ProperCase), "<b>" + StrConv(_searchFileter, VbStrConv.ProperCase) + "</b>") strNumberDisplay = strNumberDisplay + strTypeDisplay
activeRow.Cells("DisplayMatch").Value = "DEACTIVATE"
activeRow.Cells("DisplayMatchNumber").Value = "DEACTIVATE" End Sub
I even set the values of the cells to just be a text word to try to test this but the value never updates.
Private Sub grdResults_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles grdResults.InitializeLayout
grdResults.UseAppStyling = False grdResults.UseOsThemes = DefaultableBoolean.False grdResults.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.FromArgb(238, 238, 238) grdResults.DisplayLayout.Override.ActiveRowAppearance.ForeColor = Color.Black grdResults.DisplayLayout.Override.ActiveRowAppearance.BorderColor = Color.Black grdResults.DisplayLayout.Override.ActiveRowAppearance.BorderAlpha = Alpha.Transparent grdResults.DisplayLayout.Override.HeaderAppearance.BackColor = Color.White 'FromArgb(210, 226, 223) grdResults.DisplayLayout.Override.HeaderAppearance.BackGradientStyle = GradientStyle.None grdResults.DisplayLayout.Override.HeaderAppearance.BorderAlpha = Alpha.Opaque grdResults.DisplayLayout.Override.BorderStyleCell = UIElementBorderStyle.None grdResults.DisplayLayout.Override.RowAppearance.BorderColor = Color.FromArgb(204, 204, 204) grdResults.DisplayLayout.Appearance.BackColor = Color.White grdResults.DisplayLayout.Appearance.BorderAlpha = Alpha.Transparent grdResults.DisplayLayout.Override.RowAppearance.BackColor = Color.White grdResults.DisplayLayout.Override.DefaultRowHeight = 55 grdResults.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect grdResults.DisplayLayout.ViewStyleBand = ViewStyleBand.Vertical grdResults.DisplayLayout.Bands(0).ColHeadersVisible = False
grdResults.DisplayLayout.Override.CellAppearance.TextVAlign = VAlign.Middle grdResults.DisplayLayout.Override.CellAppearance.ImageVAlign = VAlign.Middle grdResults.DisplayLayout.Override.RowSizing = RowSizing.AutoFixed
grdResults.DisplayLayout.AutoFitStyle = AutoFitStyle.ExtendLastColumn
For Each ugc As UltraGridColumn In grdResults.DisplayLayout.Bands(0).Columns If ugc.Key <> "DisplayMatch" And ugc.Key <> "DisplayMatchNumber" Then 'AndAlso ugc.Key <> "Yprevbal" AndAlso ugc.Key <> "PastDueBalance" 'AndAlso ugc.Key <> "TaxPropertyMasterId" Then ugc.Hidden = True ElseIf ugc.Key = "DisplayMatch" Then ugc.Width = grdResults.Width - 180 'ElseIf ugc.Key = "DisplayMatchTypeIcon" Then ' ugc.Width = grdResults.Width - 40 End If ugc.CellActivation = Activation.NoEdit Next
End Sub
Private Sub grdResults_InitializeRow(sender As Object, e As InitializeRowEventArgs) Handles grdResults.InitializeRow Dim strDisplay As String Dim strNumberDisplay As String Dim strTypeDisplay As String
strDisplay = "<p><span style=""font-size: 12pt; line-height: 1.44; color: black;"">" + Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.EscapeXML(StrConv(CStr(e.Row.Cells("Name").Value), VbStrConv.ProperCase)) + "</span></p>"
strDisplay = strDisplay + " " + "<span style=""font-size: 10pt; line-height: 1.44; color: #666666;"">" + Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.EscapeXML(StrConv(e.Row.Cells("Address1").Value, VbStrConv.ProperCase)) + "</span>"
strTypeDisplay = "" If e.Row.Cells("Status").Value = "A" Then strTypeDisplay = strTypeDisplay + GetImageTag(CsiImageResources.CsiImageList.Images(52), 16, 16, 3, 10) Else strTypeDisplay = strTypeDisplay + GetImageTag(CsiImageResources.CsiImageList.Images(54), 16, 16, 3, 10) End If
If e.Row.Cells("ResultType").Value = CentralSearchResultType.Customer Then strTypeDisplay = strTypeDisplay + GetImageTag(CsiImageResources.CsiImageList.Images(40), 16, 16, 3, 10) ElseIf e.Row.Cells("ResultType").Value = CentralSearchResultType.Vendor Then strTypeDisplay = strTypeDisplay + GetImageTag(CsiImageResources.CsiImageList.Images(44), 16, 16, 3, 10) Else strTypeDisplay = strTypeDisplay + GetImageTag(CsiImageResources.CsiImageList.Images(48), 16, 16, 3, 10) End If
strNumberDisplay = "<p align=""right""><span style=""font-size: 10pt; line-height: 1.44; color: #666666;"">#" + Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.EscapeXML(StrConv(e.Row.Cells("AccountNumber").Value, VbStrConv.ProperCase)) + "</span></p>" strNumberDisplay = strNumberDisplay.Replace(StrConv(_searchFileter, VbStrConv.ProperCase), "<b>" + StrConv(_searchFileter, VbStrConv.ProperCase) + "</b>") strNumberDisplay = strNumberDisplay + strTypeDisplay
e.Row.Cells("DisplayMatch").Value = strDisplay
e.Row.Cells("DisplayMatchNumber").Value = strNumberDisplay End Sub
I tried using the UpdateData call after I changed what wa sin the cell but what shows on the screen does not seem to change. I will shorten my code to show what I am trying to do. I am updating data in unbound columns just for display purposes. I don't need the bound data updated I just nee dthe grid to reflect the changes. I am tyrign to change the contents of cells in the row I am leaving and the one I am going to but I never see the ACTIVATE or DEACTIVATE show up. It remains the content that was put into the grid in the InitializeRow event. There 2 unbould columns are of type FormattedText I don't knwo if that makes a difference.
Private Sub grdResults_BeforeRowDeactivate(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles grdResults.BeforeRowDeactivate Dim activeRow As UltraGridRow = grdResults.ActiveRow
activeRow.Cells("DisplayMatchNumber").Value = "DEACTIVATE" grdResults.UpdateData() End Sub
Private Sub grdResults_AfterRowActivate(sender As Object, e As EventArgs) Handles grdResults.AfterRowActivate Dim activeRow As UltraGridRow = grdResults.ActiveRow
activeRow.Cells("DisplayMatch").Value = "ACTIVATE"
activeRow.Cells("DisplayMatchNumber").Value = "ACTIVATE" grdResults.UpdateData() End Sub
There are a several ways to effect how your rows are updated.
First by calling UpdateData method on the grid object you can commit any modified information. You can use this method in the AfterSelectChange event which will be handled when a row is selected.
Setting the UpdateMode property to OnRowChange will help too.
Do let me know if you have any questions. For more information on these properties please refer to our online documentation.
UpdateMode enum
UpdateData