| | |
C#Net2003 - Add CheckBox in DataGrid
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Mar 2006
Posts: 26
Reputation:
Solved Threads: 0
0
#11 22 Days Ago
Hi Vinnijian,
DateGrid is only in C#.Net 2003 while DataGridView is in C#.Net 2005.
In C#Net, the DataGrid property does not have item COLUMN.
Not all the scripts in C#.Net 2005 is applicable in C#.Net 2003. Please help me with script for C#.Net 2003. Thank you very much.
DateGrid is only in C#.Net 2003 while DataGridView is in C#.Net 2005.
In C#Net, the DataGrid property does not have item COLUMN.
Not all the scripts in C#.Net 2005 is applicable in C#.Net 2003. Please help me with script for C#.Net 2003. Thank you very much.
Last edited by LennieKuah; 22 Days Ago at 3:42 pm.
Have a Good Day.
Cheers,
Lennie
Cheers,
Lennie
•
•
Join Date: Mar 2006
Posts: 26
Reputation:
Solved Threads: 0
0
#12 16 Days Ago
Hi Vinnijian and All Helpers
Yeee...Haa.......Finally I got the script working. Thanks to you guys for sharing your knowledge with me. You guys and this FORUM are awesome
I would like to post the script here to share with newbie like me facing the same problems:
/* ------------------------------------------------------------------ */
THANKS TO ALL OF YOU.
Yeee...Haa.......Finally I got the script working. Thanks to you guys for sharing your knowledge with me. You guys and this FORUM are awesome
I would like to post the script here to share with newbie like me facing the same problems:
C# Syntax (Toggle Plain Text)
private void FLoadDataGrid() { try { string strSql = "Select FirstName, LastName from TblCustomer "; sqlConn = new SqlConnection(connStr); sqlConn.Open(); DA = new SqlDataAdapter(strSql, sqlConn); DS = new DataSet("DS"); //Clear dataset before refill DS.Clear(); DS.CaseSensitive = true; DA.Fill(DS,"PatientTbl"); //declare datatable DataTable DT = new DataTable(); DT.Clear(); DT = DS.Tables[0]; DataColumn colNewDGCol = new DataColumn(); colNewDGCol.DataType = System.Type.GetType("System.Boolean"); colNewDGCol.DefaultValue = false; colNewDGCol.ColumnName = ("Selected"); DT.Columns.Add(colNewDGCol); //... file datagrid FFormatDataGridColumn(); dataGrid1.DataSource = DT; } catch (Exception Ex) { MessageBox.show(Ex.Message); } finally { sqlConn.Close(); } }
C# Syntax (Toggle Plain Text)
private void FFormatDataGridColumn() //define column structure for datagrid { // declare tablestyle DataGridTableStyle DGStyle; DGStyle = new DataGridTableStyle(); DGStyle.MappingName = "PatientTbl"; //checkbox column DataGridBoolColumn chkboxCol = new DataGridBoolColumn(); chkboxCol.MappingName = "Selected"; chkboxCol.HeaderText = ""; chkboxCol.Width = 50; DGStyle.GridColumnStyles.Add(chkboxCol); //Firstname textbox column DataGridColumnStyle colFName = new DataGridTextBoxColumn(); colFName.MappingName = "FirstName"; colFName.HeaderText = "First Name"; colFName.Width = 150; DGStyle.GridColumnStyles.Add(colFName); //lastName textbox column DataGridColumnStyle colLName = new DataGridTextBoxColumn(); colLName.MappingName = "LastName"; colLName.HeaderText = "Last Name"; colLName.Width = 150; DGStyle.GridColumnStyles.Add(colLName); // add table style to the dataGrid this.dataGrid1.TableStyles.Add(DGStyle); }
THANKS TO ALL OF YOU.
Have a Good Day.
Cheers,
Lennie
Cheers,
Lennie
![]() |
Similar Threads
- How can I add a checkbox to a datagrid? (ASP.NET)
- How to add a colimn in Datagrid at runtime (C#)
- Checkbox in Datagrid has to click twice to uncheck. (VB.NET)
- to add checkbox in asp.net in gridview (ASP.NET)
- How to add a new row to a datagrid (C#)
- Selcet/Deselcet All checkbox in Datagrid using Javascript (JavaScript / DHTML / AJAX)
- add column to datagrid form dropdownlist selectitem (VB.NET)
- checkbox in datagrid (ASP.NET)
Other Threads in the C# Forum
- Previous Thread: C# Maximized Forms Are Still Movable And resizeable
- Next Thread: Where Can I get a C# Compiler
| Thread Tools | Search this Thread |
.net access activedirectory ado.net algorithm array barchart bitmap box broadcast c# check checkbox client combobox contorl control conversion csharp custom database datagrid datagridview dataset datetime degrees deployment development disabled displayingopenforms draganddrop drawing editing editor encryption enum excel file foreach form format forms ftp function gdi+ httpwebrequest i18n image imageprocessing index index-error input install java label list listbox mandelbrot math mathematics mouseclick mysql operator oracle path photoshop picturebox pixelinversion post prime programming radians regex remoting richtextbox rows server setup sleep socket sql statistics stream string table text textbox thread time timer update user usercontrol validation visualstudio webbrowser windows winforms wpf xml





