We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Mask Edit a whole column and color codes

Thread ID:

Created:

Updated:

Platform:

Replies:

20165 Oct 11,2004 09:38 PM Oct 12,2004 01:13 AM Windows Forms 1
loading
Tags: GridControl
David Tichenor
Asked On October 11, 2004 09:38 PM

2 questions - I would like to mask edit column 7 with "9999-99-99" - the code below didn''t work - what did i do wrong? Also where are the color definitions for Color.FromArgb(255, 255, 255) - I want to what integers represent colors such as yellow? Private Sub Datagrid10_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles Datagrid10.PrepareViewStyleInfo Dim grid As GridDataBoundGrid = sender If Not (grid Is Nothing) AndAlso e.RowIndex > grid.Model.Rows.HeaderCount AndAlso e.ColIndex > grid.Model.Cols.HeaderCount Then If grid.IsShowCurrentRow(e.RowIndex) AndAlso Not grid.CurrentCell.HasCurrentCellAt(e.RowIndex, e.ColIndex) Then e.Style.BackColor = SystemColors.Highlight e.Style.TextColor = SystemColors.HighlightText Else Dim rs As GridBoundRecordState = grid.Binder.GetRecordStateAtRowIndex(e.RowIndex) If rs.Position Mod 2 = 0 Then e.Style.BackColor = Color.FromArgb(255, 255, 255) Else e.Style.BackColor = Color.FromArgb(219, 226, 242) End If End If End If If e.ColIndex = 7 And e.RowIndex = 1 Then ''e.Style.Font.Italic = True e.Style.Font.Bold = True ''e.Style.Font.Orientation = 270 e.Style.TextColor = Color.Red End If If e.ColIndex = 7 And e.RowIndex > 1 Then e.Style.MaskEdit.Mask = "9999-99-99" End If End Sub ''gridDataBoundGrid1_PrepareViewStyleInfo

Administrator [Syncfusion]
Replied On October 12, 2004 01:13 AM

There is no code that sets e.Style.CellType = "MaskEdit" in the code you listed. Are you setting this somewhere else? I would first try setting e.Style.CellType = "MaskEdit" in PrepareViewStyleinfo to see if that is what is missing. Or, since you want to set the whole column to be this celltype, you can just directly set it once in formload using either grid.GridBoundColumns(6).StyleInfo or grid.Binder.InternalCOlumns(6).StyleInfo to set both the CellType property and the Mask proeprty for this column. (Use GridBoundColumns if you have explicitly added them or you Binder.InternalCOlumns if you have not explicitly added gridboundcolumns.) If neither of the other suggestions allow things to work, there are some style setting that do not work when being set within PrepareViewStyleInfo. (ReadOnly is one such setting.) I am not sure if trying to set MaskEdit is one of these or not. But if you are setting style.CellType = "MaskEdit" in your code somehow, then celltype = "MaskEdit" may be like ReadOnly in that it needs to be set earlier than PrepareViewStyleInfo. In these case, you can use grid.Model.QueryCellInfo to set these style properties. See this KB for sample code. http://www.syncfusion.com/Support/article.aspx?id=10351

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;