473,796 Members | 2,904 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datagrid add checkboxes

i have the folowing code to setup my datagrid collumns

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

gridsetup()

end sub

Private Sub gridsetup()

O.Columns.Add(" Channel")

O.Columns.Add(" Name")

O.Columns.Add(" Status")

O.Columns.Add(" On")

O.Columns.Add(" Time Modified")

DataGrid1.DataS ource = O

End Sub

then i can add rows with some more code

but now my question is, how can y simply add a collumn with checkboxes

thanks Maarten
Nov 21 '05 #1
4 1384
Maarten,

This link about this question I sent yesterday to the message where you were
asking almost the same question.

http://msdn.microsoft.com/library/de...classtopic.asp

Did you not see it?

Cor

"Maarten" <gu******@hotma il.com>
i have the folowing code to setup my datagrid collumns

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

gridsetup()

end sub

Private Sub gridsetup()

O.Columns.Add(" Channel")

O.Columns.Add(" Name")

O.Columns.Add(" Status")

O.Columns.Add(" On")

O.Columns.Add(" Time Modified")

DataGrid1.DataS ource = O

End Sub

then i can add rows with some more code

but now my question is, how can y simply add a collumn with checkboxes

thanks Maarten

Nov 21 '05 #2
indeed i went to the link yesterday, but the code ther looks all so complex
they generate the controls at runtime, and i can't figure out how to make a
collumstyle.

i added tried to shange some code to let the grid display a column with
checkboxes with my databinding, but it won't work.

i hope someone can help me

kind regards Maarten
"Maarten" <gu******@hotma il.com> wrote in message
news:41******** *************** @news.skynet.be ...
i have the folowing code to setup my datagrid collumns

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

gridsetup()

end sub

Private Sub gridsetup()

O.Columns.Add(" Channel")

O.Columns.Add(" Name")

O.Columns.Add(" Status")

O.Columns.Add(" On")

O.Columns.Add(" Time Modified")

DataGrid1.DataS ource = O

End Sub

then i can add rows with some more code

but now my question is, how can y simply add a collumn with checkboxes

thanks Maarten

Nov 21 '05 #3
Maarten,

You cannot make a datagrid with checkboxes without the columnstyles, you are
even lucky that there is a standard boolcolumnstyle

On this page is as well a sample
http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps?

Cor
"Maarten" <gu******@hotma il.com>
indeed i went to the link yesterday, but the code ther looks all so
complex
they generate the controls at runtime, and i can't figure out how to make
a collumstyle.

i added tried to shange some code to let the grid display a column with
checkboxes with my databinding, but it won't work.

i hope someone can help me

kind regards Maarten
"Maarten" <gu******@hotma il.com> wrote in message
news:41******** *************** @news.skynet.be ...
i have the folowing code to setup my datagrid collumns

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

gridsetup()

end sub

Private Sub gridsetup()

O.Columns.Add(" Channel")

O.Columns.Add(" Name")

O.Columns.Add(" Status")

O.Columns.Add(" On")

O.Columns.Add(" Time Modified")

DataGrid1.DataS ource = O

End Sub

then i can add rows with some more code

but now my question is, how can y simply add a collumn with checkboxes

thanks Maarten


Nov 21 '05 #4
ok i found some code to setup the table, and se collums.

but how can add some cource.

i tried to do so, but the styles do not effect the grid.

this is what i did.

Private Sub Form5_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

FormatGridWithB othTableAndColu mnStyles()

addata()

End Sub

Private Sub FormatGridWithB othTableAndColu mnStyles()

With DataGrid1

..BackColor = Color.GhostWhit e

..BackgroundCol or = Color.Lavender

..BorderStyle = BorderStyle.Non e

..CaptionBackCo lor = Color.RoyalBlue

..CaptionFont = New Font("Tahoma", 10.0!, FontStyle.Bold)

..CaptionForeCo lor = Color.Bisque

..CaptionText = "Northwind Products"

..Font = New Font("Tahoma", 8.0!)

..ParentRowsBac kColor = Color.Lavender

..ParentRowsFor eColor = Color.MidnightB lue

..DataSource() = D

End With

Dim grdTableStyle1 As New DataGridTableSt yle()

With grdTableStyle1

..AlternatingBa ckColor = Color.GhostWhit e

..BackColor = Color.GhostWhit e

..ForeColor = Color.MidnightB lue

..GridLineColor = Color.RoyalBlue

..HeaderBackCol or = Color.MidnightB lue

..HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)

..HeaderForeCol or = Color.Lavender

..SelectionBack Color = Color.Teal

..SelectionFore Color = Color.PaleGreen

..MappingName = "Controler"

..PreferredColu mnWidth = 125

..PreferredRowH eight = 15

End With

Dim grdColStyle1 As New DataGridBoolCol umn()

With grdColStyle1

..HeaderText = "On/Off"

..MappingName = "ID"

..Width = 50

End With

Dim grdColStyle2 As New DataGridTextBox Column()

With grdColStyle2

..HeaderText = "Name"

..MappingName = "ChannelNam e"

End With

Dim grdColStyle3 As New DataGridTextBox Column()

With grdColStyle3

..HeaderText = "Value"

..MappingName = "Value"

..Width = 75

..ReadOnly = True

End With

grdTableStyle1. GridColumnStyle s.AddRange(New DataGridColumnS tyle()
{grdColStyle1, grdColStyle2, grdColStyle3, grdColStyle4})

DataGrid1.Table Styles.Add(grdT ableStyle1)

End Sub

Private Sub addata()

Public D As New DataTable()

D.Columns.Add(" Channel")

D.Columns.Add(" Name")

D.Columns.Add(" Value")

R = D.NewRow

R.Item(0) = true

R.Item(1) = dchanName(e.Ind ex + 1)

R.Item(2) = dchanState(e.In dex + 1)

R.Item(3) = dchanPos(e.Inde x + 1)

D.Rows.Add(R)
End Sub

i know this can't work, becouse when i add the code, i generate a datatable
independent from the table i created.

but how can i add the last items, so the get places in the formated
collumns

kind regard, and sorry i keep on troubeling you with probably stupid
questions.

Maarten
Nov 21 '05 #5

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

Similar topics

3
2255
by: john | last post by:
I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the user clicks on a certain button on the page, which is not in the grid, I want to be able to traverse through all the checkboxes in that column and see how many are checked. This is so that I can give them a confirmation dialog before I do an action on the selected rows. How can I use javascript to traverse through the checkboxes and count...
2
1712
by: Mortar | last post by:
i have a datagrid with a column of html checkboxes which are created dynamically. The id/name of the checkboxes comes from a value in the database. on a postback, i would like to get all the checked checkboxes, in the same way old asp would. i.e. for each control in Request.Form... i am doing it this way because the datagrid will contain too much info to maintain viewstate; i don't want to use session variables to hold
1
2051
by: kannadasan | last post by:
Hi all I am using Datagrid where i place checkboxes in one column with some other columns.The purpose is, if i select the checkboxes and clicks the submit buton Email has to go to the selected Categories. The problem here is after clicking submit button i found the checkboxes are not unchecked (cleared) even though i put EnableViewState="False".
7
2421
by: DJ Dev | last post by:
Hi All, I have a complex problem. I have dropdownlists (usually 3-5) and the user selects some value from these and for each value selected, datagrids are shown to the user. I am creating the Datagrids dynamically using a loop depending on the number of Dropdownlists. The datagrids also have a checkbox template column. Now my problem is that how can I access the values selected by the user from these checkboxes. He checks one or more...
2
3196
by: john | last post by:
I posted this question to comp.lang.javascript but didn't get a response, so I'll try here. I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the user clicks on a certain button on the page, which is not in the grid, I want to be able to traverse through all the checkboxes in that column and see how many are checked. This is so that I can give them a confirmation dialog before I do an action...
2
2469
by: Mortar | last post by:
i have a datagrid with 2 columns. the 1st column contains an id which will be used by the database for the selected checkbox records. the 2nd column is a template column containing a server checkbox control. where i'm at: i can retrieve a count of the selected checkboxes, but don't know how to get the related id's (in the 1st column).
7
2902
by: Jaime Stuardo | last post by:
Hi all.. I have a DataGrid with checkboxes. In the header I have a "check all" checkbox. I'm wondering if there is an easy way to check all checkboxes using that checkbox. I could do it using JavaScript code, but the main problem I have is that checkboxes ids aren't kept when the datagrid is rendered, for example, if the checkboxes have the name chkNumid, when the datagrid is rendered, the checkboxes become dgDataGrid_ctl02_chkNumId,
3
1809
by: GatorBait | last post by:
Hi all, I'm using a datagrid for the first time and I am running into some problems that I hope someone can help me with. I have a datagrid with 18 rows and 5 columns....column 1 is just text and columns 2-5 are checkboxes. Some of the checkboxes have to be invisible, and in some cases some of the checkboxes have be be enabled=false. I have it now so that the entire grid is populated correctly, but I am having an extremely difficult...
7
2517
by: rn5a | last post by:
The first column of a DataGrid has a CheckBox for all the rows. I want that when users check a CheckBox, the BackColor of that entire row in the DataGrid should change to a different color. To implement this, if I am not mistaken, I HAVE TO post the Form first i.e. set the AutoPostBack property of the CheckBox to True. Without posting the Form, I don't think the BackColor of the checked row can be changed using ASP.NET, isn't it? Of...
5
2911
by: rn5a | last post by:
In my application, I want to populate all the directories & files existing in a directory on the server in a DataGrid. To ensure that all the directories get listed first followed by all the files, I am appending all the directories with 0 & all the files with 1. Moreover, each directory & file listed in the DataGrid will have a corresponding CheckBox. To differentiate between directories & files, I am adding the string "*D" (without the...
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10467
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10244
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10021
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7558
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.