Imports
System.Data.SqlClient
Public
Class
Form1
Private
_dvNames_List
As
New
DataView
Private
Sub
Button1_Click(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
Button1.Click
Dim
sSQLConnection
As
String
=
"MYSQLCONNECTION"
Dim
oConn
As
New
SqlConnection(sSQLConnection)
Dim
oCommand
As
New
SqlCommand
Dim
oDT
As
New
DataTable
Dim
oDA
As
SqlDataAdapter
Try
oConn.Open()
With
oCommand
.Connection = oConn
.CommandTimeout = 15
.CommandType = CommandType.StoredProcedure
.CommandText =
"cp_MyStoredProc"
End
With
oDA =
New
SqlDataAdapter(oCommand)
oDA.Fill(oDT)
oDT.TableName =
"SQLDATATABLE"
_dvNames_List.Table = oDT
Catch
ex
As
Exception
Throw
New
Exception(ex.Message, ex)
End
Try
End
Sub
Private
Sub
Form1_Load(sender
As
Object
, e
As
System.EventArgs)
Handles
Me
.Load
RadDropDownList1.ValueMember =
"nameid"
RadDropDownList1.DisplayMember =
"name"
RadDropDownList1.DataSource = _dvNames_List
End
Sub
End
Class
I've got a hierarchy gridView in my winform that allows the user to pick items to include.
In the hierarchy the parent is a "category", and the child rows are "category items".
In the grid, there's 2 columns for both the parents and children: a checkbox (Include?) and a textbox ("category name" for parent rows, "item name" for child rows).
The checkbox in the parent row in the grid is equivalent to a "Select All" at the top of a grid used to check all items, but instead of checking all items in the grid, when check, only the checkbox of it's child rows should be checked. This way the user can pick individual "items" to include, or all items in a category, by clicking one checkbox.
The primary problem I've had with this is that when a parent row checkbox item is checked, the checkboxes of that category's child rows don't get checked until a second checkbox in the grid is checked. It's like the checkbox checking/unchecking isn't actually performed until another event fires.
I've tried handling this in rowChanged, valueChanged, CellEndEdit, CellValueChanged, and other events, and they all seem to do what I want in debugging, but the visible checking of child row checkboxes doesn't happen when it should.
I'm opposed to posting any of the code I've tried since I've tried so many approaches and just seem to be going round and round, but will instead put it in pseudocode format. So here's what I'm trying to accomplish:
Private Sub gridItems_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gridItems.ValueChanged
'If the changed item is a parent row checkbox Then
' For each childRow in currentRow.childRows
' childRow.checkboxColumn.checkboxEditor.Value = currentRow.checkboxColumn.checkBoxEditor.Value
' Next
'End If
End Sub
Thank you in advance for any suggestions and advice.
Dan