'---Transaction bill Load Query---
Private Sub transHistoryLoad()
Dim constring As String = AlgoMdConnectionString
Try
Using con As New SqlConnection(constring)
Using cmd As New SqlCommand("SELECT
[TTD_Col_Caption]
,[TTD_Col_UniqID]
,[TTD_Col_Visible]
,[TTD_Col_Display_order]
,[TTD_Col_DisplayType]
,[TTD_Col_DataType]
,[TTD_Col_Editable]
,[TTD_Col_Tab]
,[TTD_Col_Skip]
,[TTD_Col_Defa]
,[TTD_Col_NoDuplicates]
,[TTD_Col_Tab]
,'False' AS [Select All]
FROM [dbo].[Tbl_Trans_Details]
", con)
cmd.CommandType = CommandType.Text
Using sda As New SqlDataAdapter(cmd)
Using ds As New DataSet()
sda.Fill(ds)
If ds.Tables(0).Rows.Count > 0 Then
grdMain.Columns.Add(New GridCheckBoxColumn() With {.MappingName = "Select All", .HeaderText = "Select All", .CheckBoxSize = New Size(15, 15), .TrueValue = "True", .FalseValue = "False"})
TryCast(Me.grdMain.Columns("Select All"), GridCheckBoxColumn).AllowCheckBoxOnHeader = True
Me.grdMain.Columns("Select All").HeaderText = String.Empty
Me.grdMain.Columns("Select All").AllowEditing = True
TryCast(Me.grdMain.Columns("Select All"), GridCheckBoxColumn).AllowText = True
grdMain.DataSource = ds.Tables(0)
Else
Dim info As New FrmInfoMsgBox
info.lblmsg.Text = "Sorry, No Records Available"
info.ShowDialog()
End If
End Using
End Using
End Using
End Using
Catch ex As Exception
IO.File.AppendAllText(appDataPath & "\Log.txt", String.Format("{0}{1}", Environment.NewLine, ex.ToString()))
Dim x As New FrmErrorMsgBox
x.txterrormsg.Text = ex.Message.ToString
x.ShowDialog()
End Try
End Sub
--the above lines are loading statements in Sfdatagrid
and now, i have to capture checked and unchecked status in for loop. And, I have to resize the panel if checked status is more than 0.
Private Sub grdMain_CellCheckBoxClick(sender As Object, e As CellCheckBoxClickEventArgs) Handles grdMain.CellCheckBoxClick
If grdMain.CurrentCell.ColumnIndex = 0 Then
grdMain.CurrentCell.CellRenderer.SetControlValue("True")
Dim dt As New DataTable
dt = grdMain.DataSource
Dim x As Integer
Call grdMain.CurrentCell.EndEdit()
For Each row In dt.Rows
If row("Select All") = "True" Then
x = x + 1
End If
Next
MsgBox(x)
End If
End sub
and, i have try this. it does captures the checked or unchecked status delayed. i mean the 'x' value is 0 even after clicking checkbox to 'True', the 'x' value returns '1' only after clicking next checkbox cell.
it should change 'x' as 1 when clicking the checkbox cell for the first time..
and, also sfdatagrid doesnot have CurrentCellValueChanged event.. and i do the same line of coding in CurrentCellValidating and CurrentCellEndEdit, it doesnot results anything