Hi
You can write a Class that inherits.. "DataGridBoolColumn".
Override all the required Values..for the inherited class.. in the constructor.
Code goes something like this...
Public Class CGridCheckBoxStyle
Inherits DataGridBoolColumn
Public Sub New(ByVal MappingName As String)
MyBase.New()
Me.MappingName = MappingName
End Sub
Public Sub New(ByVal MappingName As String, _
ByVal Width As Integer, _
ByVal Alignment As HorizontalAlignment, _
ByVal [ReadOnly] As Boolean, _
ByVal HeaderText As String, _
ByVal NullText As String, _
ByVal FalseValue As Object, _
ByVal TrueValue As Object, _
ByVal AllowNull As Boolean, _
ByVal NullValue As Object)
Me.New(MappingName)
Me.Alignment = Alignment
Me.Width = Width
Me.ReadOnly = [ReadOnly]
Me.HeaderText = HeaderText
Me.FalseValue = FalseValue
Me.TrueValue = TrueValue
Me.NullText = NullText
Me.NullValue = NullValue
Me.AllowNull = AllowNull
End Sub
End Class
And use this class in the main class where u want to show the grid...
like this..
After filling the DataAdapter..
dataAdapter.Fill(dt)
'Create a TableStyle to which ColumnStyles will be added
Dim ts As DataGridTableStyle
ts.GridColumnStyles.Clear()
ts.MappingName = dt.TableName
'CheckBox Column
Dim cs1 As New CGridCheckBoxStyle("Column1", 60, _
HorizontalAlignment.Center, False, _
"Select", "", False, True, False, False)
ts.GridColumnStyles.Add(col)
This will Add CheckBoxes to a Bound Datagrid.
Hope it is clear
Regards
Packiyanath. |