|
-
Sep 27th, 2005, 10:28 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Enable/Disable Column in a DataGrid?
I tried this but it seems to do absolutly nothing.
VB Code:
Private Sub Session5SupportedCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Session5SupportedCheckBox.CheckedChanged
If Session5SupportedCheckBox.Checked = True Then
dtService.Columns.Item(6).ReadOnly = False
DataGridServices.Refresh()
Else
dtService.Columns.Item(6).ReadOnly = True
DataGridServices.Refresh()
End If
End Sub
Last edited by fdunford; Sep 27th, 2005 at 02:37 PM.
-
Sep 27th, 2005, 11:02 AM
#2
Re: Enable/Disable Colunm in a DataGrid?
Is this DataGrid is bounded to a DataGridTableStyle and DataGridColumnStyle ?
-
Sep 27th, 2005, 11:06 AM
#3
Thread Starter
Hyperactive Member
Re: Enable/Disable Colunm in a DataGrid?
-
Sep 27th, 2005, 12:02 PM
#4
Re: Enable/Disable Colunm in a DataGrid?
Well Have you try to Disabled the Column by it's bounded DataGridColumnStyle ?
-
Sep 27th, 2005, 01:17 PM
#5
Thread Starter
Hyperactive Member
Re: Enable/Disable Colunm in a DataGrid?
Zak,
I mis-spoke. I have a DataGridTableStyle but not a DataGridColumnStyle . I just tried to figure out how to create a DataGridColumnStyle but seem to be having a bad go of it. Can you help?
code from a previous question
-
Sep 27th, 2005, 01:32 PM
#6
Re: Enable/Disable Colunm in a DataGrid?
A easy way to create DataGridColumnStyle is by the usage of the Collection editor from the DataGrid, look at the TableStyles property from the Grid and from that collection editor look for DataGridColumnStyle
You may also look at this MSDN Article for more info
http://msdn.microsoft.com/library/de...lumnstyle1.asp
Hope it will help !!
-
Sep 27th, 2005, 02:36 PM
#7
Thread Starter
Hyperactive Member
Re: Enable/Disable Colunm in a DataGrid?
Got it via the DataGridTableStyle.
VB Code:
Private Sub Session4SupportedCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Session4SupportedCheckBox.CheckedChanged
Dim dgts As DataGridTableStyle
Dim cb1 As DataGridColumnStyle
If dtService.Columns.Count > 0 Then
dgts = DataGridServices.TableStyles(sServiceTable)
cb1 = dgts.GridColumnStyles.Item(sSessionCB4)
If Session4SupportedCheckBox.Checked = True Then
gSessions(4).Mandatory = False
cb1.ReadOnly = False
Else
gSessions(4).Mandatory = True
cb1.ReadOnly = True
End If
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|