473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Add checkbox to items in a datagrid

I need to add a checkbox in front of all the rows in a datagrid so that
users can select/unselect them.

Any help is greatly appreciated!

Bill
Nov 30 '05 #1
6 1700
Bill,

A checkbox is one of the most standard ones, you don't even have to do
something for it, it is for a boolean column in the underlying datasource.

If it is not already in your table, than just add it.

This is not even needed, however to see it with styles. Look at the Add of
the boolean column in the bottom of this sample.

http://www.vb-tips.com/default.aspx?...6-3300b2215049

I hope this helps,

Cor
Nov 30 '05 #2
Thanks Cor.

I was able to add the checkbox in front of each row. There are 2 problems
though:

1. The box is dimmed and has the check mark in it. I want the box unchecked
(default value = FALSE). When I click on it, I can check or uncheck the box,
but as soon as the cursor move to the next row, the box goes back to its
original state (dimmed with box checked!)
2. This column doesn't come from the datasource for the remaining columns.
How do I select only rows (in the datasource) with the checkbox checked?

Thanks again

Bill
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Oi****************@TK2MSFTNGP14.phx.gbl...
Bill,

A checkbox is one of the most standard ones, you don't even have to do
something for it, it is for a boolean column in the underlying datasource.

If it is not already in your table, than just add it.

This is not even needed, however to see it with styles. Look at the Add of
the boolean column in the bottom of this sample.

http://www.vb-tips.com/default.aspx?...6-3300b2215049

I hope this helps,

Cor

Nov 30 '05 #3
B ill,

You have to set the boolean columns in a for each after that you have
created them to false

\\\
For each dr as datarow in dt
dr("mycolumn") = false
Next
///

To see if they are checked you do in fact in the same way or in a for index
loop.

I hope this helps,

Cor

"Bill Nguyen" <bi*****************@jaco.com> schreef in bericht
news:Oo*************@TK2MSFTNGP15.phx.gbl...
Thanks Cor.

I was able to add the checkbox in front of each row. There are 2 problems
though:

1. The box is dimmed and has the check mark in it. I want the box
unchecked (default value = FALSE). When I click on it, I can check or
uncheck the box, but as soon as the cursor move to the next row, the box
goes back to its original state (dimmed with box checked!)
2. This column doesn't come from the datasource for the remaining columns.
How do I select only rows (in the datasource) with the checkbox checked?

Thanks again

Bill
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Oi****************@TK2MSFTNGP14.phx.gbl...
Bill,

A checkbox is one of the most standard ones, you don't even have to do
something for it, it is for a boolean column in the underlying
datasource.

If it is not already in your table, than just add it.

This is not even needed, however to see it with styles. Look at the Add
of the boolean column in the bottom of this sample.

http://www.vb-tips.com/default.aspx?...6-3300b2215049

I hope this helps,

Cor


Dec 1 '05 #4
Cor;
I spent a great deal of time trying almost everything and still got the same
results. I added a boolean column (datatype = bit) to the table and set
value to zero for all rows. The column still displays a checkmark and
behaves exactly the same way (doubleclick twice changes the check stat but
goes back to dim with checkmark as soon as the cursor leaves the row).

below is my code. Please take a look and let me know what I did wrong.

Thanks a million

Bill

-------------------------
DataGrid1.Enabled = True

Dim iType As Integer = 1

Dim iSort As Integer

Dim iBool As Boolean = False

dOrder = New DataSet("mpOrder")

Dim tOrder As DataTable

'tBol = Nothing

tOrder = New DataTable("mpOrderTable")

Dim cRowID As DataColumn

cRowID = New DataColumn("rowID")

Dim cRowSelect As DataColumn

cRowSelect = New DataColumn("rowSelect")

Dim cOrderID As DataColumn

cOrderID = New DataColumn("OrderID")

Dim cStID As DataColumn

cStID = New DataColumn("StID")

Dim cStName As DataColumn

cStName = New DataColumn("StName")

Dim cscDate As DataColumn

cscDate = New DataColumn("scDate")

Dim cscTime As DataColumn

cscTime = New DataColumn("scTime")

Dim cStat As DataColumn

cStat = New DataColumn("stat")

Try

tOrder.Columns.Add(cRowID)

tOrder.Columns.Add(cRowSelect) 'checkbox column

tOrder.Columns.Add(cOrderID)

tOrder.Columns.Add(cStID)

tOrder.Columns.Add(cStName)

tOrder.Columns.Add(cscDate)

tOrder.Columns.Add(cscTime)

tOrder.Columns.Add(cStat)

dOrder.Tables.Add(tOrder)

'---

'dNULL = False

dCount = 0

'

' MsgBox(rSQL)

dMain = MAPPOINTDataBoss.dMAPSelectView(rSQL)

If dMain.Tables(0).Rows.Count = 0 Then

Beep()

Call DisplayStatus("No records found! Nothing to display.", "red")

Exit Sub

Else

Call DisplayStatus("Total Order Records: " & (dMain.Tables(0).Rows.Count),
"red")

End If

Dim dOrderRow, dmainRow As DataRow

For Each dmainRow In dMain.Tables(0).Rows

dOrderRow = tOrder.NewRow

dOrderRow("rowID") = iType.ToString

iBool = False

dOrderRow("rowSelect") = dmainRow.Item("assigned")

dOrderRow("orderID") = dmainRow.Item("IF_orderID")

dOrderRow("stID") = dmainRow.Item("stationID")

dOrderRow("stName") = dmainRow.Item("stationName")

dOrderRow("scdate") = Format(dmainRow.Item("scheduledDate"), "MM/dd/yyyy")

dOrderRow("sctime") = dmainRow.Item("scheduledTime")

dOrderRow("stat") = dmainRow.Item("if_orderStatus")

tOrder.Rows.Add(dOrderRow)

dCount += 1

Next

' Datagrid table style setup

Dim ts1 As DataGridTableStyle

' ts1 = Nothing

ts1 = New DataGridTableStyle

ts1.MappingName = "mporderTable"

ts1.AlternatingBackColor = Color.LightGray

ts1.AllowSorting = False



Dim txtCol As DataGridTextBoxColumn

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "orderID"

txtCol.HeaderText = "Order#"

txtCol.ReadOnly = True

txtCol.Width = 60

ts1.GridColumnStyles.Add(txtCol)

'

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "stID"

txtCol.HeaderText = "Station#"

txtCol.ReadOnly = True

txtCol.Width = 70

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "stName"

txtCol.HeaderText = "Station Name"

txtCol.ReadOnly = True

txtCol.Width = 240

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "scDate"

txtCol.HeaderText = "Scheduled Date"

txtCol.ReadOnly = True

txtCol.Width = 80

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "scTime"

txtCol.HeaderText = "Time"

txtCol.ReadOnly = True

txtCol.Width = 60

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "stat"

txtCol.HeaderText = "Order Status"

txtCol.ReadOnly = True

txtCol.Width = 80

ts1.GridColumnStyles.Add(txtCol)

Dim boolCol As New DataGridBoolColumn

boolCol.MappingName = "rowSelect"

boolCol.HeaderText = "Select"

boolCol.Width = 50

' boolCol.n

boolCol.AllowNull = False

boolCol.ReadOnly = False

boolCol.FalseValue = False

boolCol.TrueValue = True

ts1.GridColumnStyles.Add(boolCol)

DataGrid1.TableStyles.Clear()

DataGrid1.TableStyles.Add(ts1)

Me.DataGrid1.DataSource = dOrder

Me.DataGrid1.DataMember = "mpordertable"

Call NoAppenRow()

Catch ex As Exception

MsgBox(ex.Message & ex.Source)

Catch ex As SqlException

MsgBox(ex.Number & ": " & ex.Message & ex.LineNumber)

End Try



End Sub
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
B ill,

You have to set the boolean columns in a for each after that you have
created them to false

\\\
For each dr as datarow in dt
dr("mycolumn") = false
Next
///

To see if they are checked you do in fact in the same way or in a for
index loop.

I hope this helps,

Cor

"Bill Nguyen" <bi*****************@jaco.com> schreef in bericht
news:Oo*************@TK2MSFTNGP15.phx.gbl...
Thanks Cor.

I was able to add the checkbox in front of each row. There are 2 problems
though:

1. The box is dimmed and has the check mark in it. I want the box
unchecked (default value = FALSE). When I click on it, I can check or
uncheck the box, but as soon as the cursor move to the next row, the box
goes back to its original state (dimmed with box checked!)
2. This column doesn't come from the datasource for the remaining
columns. How do I select only rows (in the datasource) with the checkbox
checked?

Thanks again

Bill
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Oi****************@TK2MSFTNGP14.phx.gbl...
Bill,

A checkbox is one of the most standard ones, you don't even have to do
something for it, it is for a boolean column in the underlying
datasource.

If it is not already in your table, than just add it.

This is not even needed, however to see it with styles. Look at the Add
of the boolean column in the bottom of this sample.

http://www.vb-tips.com/default.aspx?...6-3300b2215049

I hope this helps,

Cor



Dec 7 '05 #5
Bill,

Can you next time first copy the code in a notebook, and than copy it back
and in the message. In this way it is unreadable.

I think that you have tried a lot to fullfil your goal, see the row above,
normally the scheme should come from your fill, (what is not in the code so
I assume that is that function mappointdataboss.

However if you declare a table than you have to tell what kind of columns it
are (I never do that if it are only strings in samples).

By instance like this.
\\\
Dim cscDate As New DataColumn("scDate", GetType(System.DateTime))
Dim cRowSelect As New DataColumn("rowSelect", GetType(System.Boolean))
///

Now the datagrid knows that it is a boolean column and will act acoording to
that.

(I do not know it this is the answer, however as start and if not than
please the code back as I said, (including this of course).

I hope this helps sofar

Cor
"Bill nguyen" <bi*****************@jaco.com> schreef in bericht
news:eb****************@TK2MSFTNGP11.phx.gbl...
Cor;
I spent a great deal of time trying almost everything and still got the
same results. I added a boolean column (datatype = bit) to the table and
set value to zero for all rows. The column still displays a checkmark and
behaves exactly the same way (doubleclick twice changes the check stat but
goes back to dim with checkmark as soon as the cursor leaves the row).

below is my code. Please take a look and let me know what I did wrong.

Thanks a million

Bill

-------------------------
DataGrid1.Enabled = True

Dim iType As Integer = 1

Dim iSort As Integer

Dim iBool As Boolean = False

dOrder = New DataSet("mpOrder")

Dim tOrder As DataTable

'tBol = Nothing

tOrder = New DataTable("mpOrderTable")

Dim cRowID As DataColumn

cRowID = New DataColumn("rowID")

Dim cRowSelect As DataColumn

cRowSelect = New DataColumn("rowSelect")

Dim cOrderID As DataColumn

cOrderID = New DataColumn("OrderID")

Dim cStID As DataColumn

cStID = New DataColumn("StID")

Dim cStName As DataColumn

cStName = New DataColumn("StName")

Dim cscDate As DataColumn

cscDate = New DataColumn("scDate")

Dim cscTime As DataColumn

cscTime = New DataColumn("scTime")

Dim cStat As DataColumn

cStat = New DataColumn("stat")

Try

tOrder.Columns.Add(cRowID)

tOrder.Columns.Add(cRowSelect) 'checkbox column

tOrder.Columns.Add(cOrderID)

tOrder.Columns.Add(cStID)

tOrder.Columns.Add(cStName)

tOrder.Columns.Add(cscDate)

tOrder.Columns.Add(cscTime)

tOrder.Columns.Add(cStat)

dOrder.Tables.Add(tOrder)

'---

'dNULL = False

dCount = 0

'

' MsgBox(rSQL)

dMain = MAPPOINTDataBoss.dMAPSelectView(rSQL)

If dMain.Tables(0).Rows.Count = 0 Then

Beep()

Call DisplayStatus("No records found! Nothing to display.", "red")

Exit Sub

Else

Call DisplayStatus("Total Order Records: " & (dMain.Tables(0).Rows.Count),
"red")

End If

Dim dOrderRow, dmainRow As DataRow

For Each dmainRow In dMain.Tables(0).Rows

dOrderRow = tOrder.NewRow

dOrderRow("rowID") = iType.ToString

iBool = False

dOrderRow("rowSelect") = dmainRow.Item("assigned")

dOrderRow("orderID") = dmainRow.Item("IF_orderID")

dOrderRow("stID") = dmainRow.Item("stationID")

dOrderRow("stName") = dmainRow.Item("stationName")

dOrderRow("scdate") = Format(dmainRow.Item("scheduledDate"), "MM/dd/yyyy")

dOrderRow("sctime") = dmainRow.Item("scheduledTime")

dOrderRow("stat") = dmainRow.Item("if_orderStatus")

tOrder.Rows.Add(dOrderRow)

dCount += 1

Next

' Datagrid table style setup

Dim ts1 As DataGridTableStyle

' ts1 = Nothing

ts1 = New DataGridTableStyle

ts1.MappingName = "mporderTable"

ts1.AlternatingBackColor = Color.LightGray

ts1.AllowSorting = False



Dim txtCol As DataGridTextBoxColumn

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "orderID"

txtCol.HeaderText = "Order#"

txtCol.ReadOnly = True

txtCol.Width = 60

ts1.GridColumnStyles.Add(txtCol)

'

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "stID"

txtCol.HeaderText = "Station#"

txtCol.ReadOnly = True

txtCol.Width = 70

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "stName"

txtCol.HeaderText = "Station Name"

txtCol.ReadOnly = True

txtCol.Width = 240

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "scDate"

txtCol.HeaderText = "Scheduled Date"

txtCol.ReadOnly = True

txtCol.Width = 80

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "scTime"

txtCol.HeaderText = "Time"

txtCol.ReadOnly = True

txtCol.Width = 60

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "stat"

txtCol.HeaderText = "Order Status"

txtCol.ReadOnly = True

txtCol.Width = 80

ts1.GridColumnStyles.Add(txtCol)

Dim boolCol As New DataGridBoolColumn

boolCol.MappingName = "rowSelect"

boolCol.HeaderText = "Select"

boolCol.Width = 50

' boolCol.n

boolCol.AllowNull = False

boolCol.ReadOnly = False

boolCol.FalseValue = False

boolCol.TrueValue = True

ts1.GridColumnStyles.Add(boolCol)

DataGrid1.TableStyles.Clear()

DataGrid1.TableStyles.Add(ts1)

Me.DataGrid1.DataSource = dOrder

Me.DataGrid1.DataMember = "mpordertable"

Call NoAppenRow()

Catch ex As Exception

MsgBox(ex.Message & ex.Source)

Catch ex As SqlException

MsgBox(ex.Number & ": " & ex.Message & ex.LineNumber)

End Try



End Sub
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
B ill,

You have to set the boolean columns in a for each after that you have
created them to false

\\\
For each dr as datarow in dt
dr("mycolumn") = false
Next
///

To see if they are checked you do in fact in the same way or in a for
index loop.

I hope this helps,

Cor

"Bill Nguyen" <bi*****************@jaco.com> schreef in bericht
news:Oo*************@TK2MSFTNGP15.phx.gbl...
Thanks Cor.

I was able to add the checkbox in front of each row. There are 2
problems though:

1. The box is dimmed and has the check mark in it. I want the box
unchecked (default value = FALSE). When I click on it, I can check or
uncheck the box, but as soon as the cursor move to the next row, the box
goes back to its original state (dimmed with box checked!)
2. This column doesn't come from the datasource for the remaining
columns. How do I select only rows (in the datasource) with the
checkbox checked?

Thanks again

Bill
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Oi****************@TK2MSFTNGP14.phx.gbl...
Bill,

A checkbox is one of the most standard ones, you don't even have to do
something for it, it is for a boolean column in the underlying
datasource.

If it is not already in your table, than just add it.

This is not even needed, however to see it with styles. Look at the Add
of the boolean column in the bottom of this sample.

http://www.vb-tips.com/default.aspx?...6-3300b2215049

I hope this helps,

Cor



Dec 7 '05 #6
Cor;

Those dim's are fantastic! Thank for your help!!!

Bill

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eP****************@TK2MSFTNGP14.phx.gbl...
Bill,

Can you next time first copy the code in a notebook, and than copy it back
and in the message. In this way it is unreadable.

I think that you have tried a lot to fullfil your goal, see the row above,
normally the scheme should come from your fill, (what is not in the code
so I assume that is that function mappointdataboss.

However if you declare a table than you have to tell what kind of columns
it are (I never do that if it are only strings in samples).

By instance like this.
\\\
Dim cscDate As New DataColumn("scDate", GetType(System.DateTime))
Dim cRowSelect As New DataColumn("rowSelect", GetType(System.Boolean))
///

Now the datagrid knows that it is a boolean column and will act acoording
to that.

(I do not know it this is the answer, however as start and if not than
please the code back as I said, (including this of course).

I hope this helps sofar

Cor
"Bill nguyen" <bi*****************@jaco.com> schreef in bericht
news:eb****************@TK2MSFTNGP11.phx.gbl...
Cor;
I spent a great deal of time trying almost everything and still got the
same results. I added a boolean column (datatype = bit) to the table and
set value to zero for all rows. The column still displays a checkmark and
behaves exactly the same way (doubleclick twice changes the check stat
but goes back to dim with checkmark as soon as the cursor leaves the
row).

below is my code. Please take a look and let me know what I did wrong.

Thanks a million

Bill

-------------------------
DataGrid1.Enabled = True

Dim iType As Integer = 1

Dim iSort As Integer

Dim iBool As Boolean = False

dOrder = New DataSet("mpOrder")

Dim tOrder As DataTable

'tBol = Nothing

tOrder = New DataTable("mpOrderTable")

Dim cRowID As DataColumn

cRowID = New DataColumn("rowID")

Dim cRowSelect As DataColumn

cRowSelect = New DataColumn("rowSelect")

Dim cOrderID As DataColumn

cOrderID = New DataColumn("OrderID")

Dim cStID As DataColumn

cStID = New DataColumn("StID")

Dim cStName As DataColumn

cStName = New DataColumn("StName")

Dim cscDate As DataColumn

cscDate = New DataColumn("scDate")

Dim cscTime As DataColumn

cscTime = New DataColumn("scTime")

Dim cStat As DataColumn

cStat = New DataColumn("stat")

Try

tOrder.Columns.Add(cRowID)

tOrder.Columns.Add(cRowSelect) 'checkbox column

tOrder.Columns.Add(cOrderID)

tOrder.Columns.Add(cStID)

tOrder.Columns.Add(cStName)

tOrder.Columns.Add(cscDate)

tOrder.Columns.Add(cscTime)

tOrder.Columns.Add(cStat)

dOrder.Tables.Add(tOrder)

'---

'dNULL = False

dCount = 0

'

' MsgBox(rSQL)

dMain = MAPPOINTDataBoss.dMAPSelectView(rSQL)

If dMain.Tables(0).Rows.Count = 0 Then

Beep()

Call DisplayStatus("No records found! Nothing to display.", "red")

Exit Sub

Else

Call DisplayStatus("Total Order Records: " &
(dMain.Tables(0).Rows.Count), "red")

End If

Dim dOrderRow, dmainRow As DataRow

For Each dmainRow In dMain.Tables(0).Rows

dOrderRow = tOrder.NewRow

dOrderRow("rowID") = iType.ToString

iBool = False

dOrderRow("rowSelect") = dmainRow.Item("assigned")

dOrderRow("orderID") = dmainRow.Item("IF_orderID")

dOrderRow("stID") = dmainRow.Item("stationID")

dOrderRow("stName") = dmainRow.Item("stationName")

dOrderRow("scdate") = Format(dmainRow.Item("scheduledDate"),
"MM/dd/yyyy")

dOrderRow("sctime") = dmainRow.Item("scheduledTime")

dOrderRow("stat") = dmainRow.Item("if_orderStatus")

tOrder.Rows.Add(dOrderRow)

dCount += 1

Next

' Datagrid table style setup

Dim ts1 As DataGridTableStyle

' ts1 = Nothing

ts1 = New DataGridTableStyle

ts1.MappingName = "mporderTable"

ts1.AlternatingBackColor = Color.LightGray

ts1.AllowSorting = False



Dim txtCol As DataGridTextBoxColumn

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "orderID"

txtCol.HeaderText = "Order#"

txtCol.ReadOnly = True

txtCol.Width = 60

ts1.GridColumnStyles.Add(txtCol)

'

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "stID"

txtCol.HeaderText = "Station#"

txtCol.ReadOnly = True

txtCol.Width = 70

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "stName"

txtCol.HeaderText = "Station Name"

txtCol.ReadOnly = True

txtCol.Width = 240

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "scDate"

txtCol.HeaderText = "Scheduled Date"

txtCol.ReadOnly = True

txtCol.Width = 80

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "scTime"

txtCol.HeaderText = "Time"

txtCol.ReadOnly = True

txtCol.Width = 60

ts1.GridColumnStyles.Add(txtCol)

txtCol = New DataGridTextBoxColumn

txtCol.MappingName = "stat"

txtCol.HeaderText = "Order Status"

txtCol.ReadOnly = True

txtCol.Width = 80

ts1.GridColumnStyles.Add(txtCol)

Dim boolCol As New DataGridBoolColumn

boolCol.MappingName = "rowSelect"

boolCol.HeaderText = "Select"

boolCol.Width = 50

' boolCol.n

boolCol.AllowNull = False

boolCol.ReadOnly = False

boolCol.FalseValue = False

boolCol.TrueValue = True

ts1.GridColumnStyles.Add(boolCol)

DataGrid1.TableStyles.Clear()

DataGrid1.TableStyles.Add(ts1)

Me.DataGrid1.DataSource = dOrder

Me.DataGrid1.DataMember = "mpordertable"

Call NoAppenRow()

Catch ex As Exception

MsgBox(ex.Message & ex.Source)

Catch ex As SqlException

MsgBox(ex.Number & ": " & ex.Message & ex.LineNumber)

End Try



End Sub
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
B ill,

You have to set the boolean columns in a for each after that you have
created them to false

\\\
For each dr as datarow in dt
dr("mycolumn") = false
Next
///

To see if they are checked you do in fact in the same way or in a for
index loop.

I hope this helps,

Cor

"Bill Nguyen" <bi*****************@jaco.com> schreef in bericht
news:Oo*************@TK2MSFTNGP15.phx.gbl...
Thanks Cor.

I was able to add the checkbox in front of each row. There are 2
problems though:

1. The box is dimmed and has the check mark in it. I want the box
unchecked (default value = FALSE). When I click on it, I can check or
uncheck the box, but as soon as the cursor move to the next row, the
box goes back to its original state (dimmed with box checked!)
2. This column doesn't come from the datasource for the remaining
columns. How do I select only rows (in the datasource) with the
checkbox checked?

Thanks again

Bill
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Oi****************@TK2MSFTNGP14.phx.gbl...
> Bill,
>
> A checkbox is one of the most standard ones, you don't even have to do
> something for it, it is for a boolean column in the underlying
> datasource.
>
> If it is not already in your table, than just add it.
>
> This is not even needed, however to see it with styles. Look at the
> Add of the boolean column in the bottom of this sample.
>
> http://www.vb-tips.com/default.aspx?...6-3300b2215049
>
> I hope this helps,
>
> Cor
>



Dec 7 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: iforsyth | last post by:
Have a paging datagrid with a checkbox control in column(0). ViewState is enabled. I check the checkbox in first row of the grid on a page and then the program hits this event: Private Sub...
1
by: Andre | last post by:
Hi, I need some help with automatically generated checkbox in my datagrid, i'm searching everywhere and can't find a way to do this. In my datagrid i will always have more than one line, with...
2
by: Rekha | last post by:
Hi I have datagrid with 5 items. Out of which 1 items are checkboxes. The bool column(checkbox column ) in added in datagrid. The rest of Data is binded dynamically to the datagrid Based on...
10
by: Jennyfer J Barco | last post by:
Hello, I have a datagrid that brings some information from a query. I need to have a checkbox in each row so the user can select the rows he wants to reprint. Is it possible to have a checkbox...
2
by: Ceema M via DotNetMonster.com | last post by:
Hello all, I have a nested repeater, which displays categories(parent repeater) and corresponding subcategories(child repeater). Both repeaters have checkboxes. When I check category checkbox...
9
by: Rekha | last post by:
The data is filled in datagrid. I want to know how to add a checkbox column in datagrid? In the runtime, checkbox is checked then instead of checkbox value the (caseID )column value is retained....
8
by: Alan Silver | last post by:
Hello, I have a repeater that has code like this... <ItemTemplate> <asp:CheckBox ID="chkDelete" Text="" RunAt="server"/> .... other stuff goes here </ItemTemplate> There is a button below...
1
by: arun.hallan | last post by:
Hi, I have two columns in a datagrid that are filled with checkboxes. I want one checkbox in a row to be checked when the corresponding checkbox is checked. I've added an OnCheckedChanged...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
4
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.