|
#1
|
|||
|
|||
|
C#Net2003 - Add CheckBox in DataGrid
Hi Hack and Jonnin and other Helpers.
C#.Net 2003 software. I have been asked by my IT Manager to write script display data from Customer table and include CheckBox control in Column1 in all the rows. I am totally puzzled as a Newbie. Please help me. Thanks. Have a Good Day.
__________________
Cheers, Lennie Last edited by Lennie; 11-01-2009 at 04:46 AM. |
|
#2
|
||||
|
||||
|
Moved to .NET
C# and C++ are not the same thing...what works in one may, or may not, work in the other. C# is a .NET technology and questions regarding that platform should be placed in the .NET section. I found this.
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
|
#3
|
|||
|
|||
|
H Hack,
Thanks for the URL address. That URL link to C#.NET 2005 instead of C#.Net 2003. Hack, I am very glad to be your friend. Thanks anyway.
__________________
Cheers, Lennie Last edited by Lennie; 11-03-2009 at 03:26 PM. |
|
#4
|
||||
|
||||
|
Thats because I can't find anything specific to 2003 - as it is, I'm starting to have trouble finding stuff for 2005 (it is rapidly all moving to 2008)
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
|
#5
|
|||
|
|||
|
Hi Hack,
I thank you very much for helping me and understand the situation you are in. Just that my company doesn't want to upgrade from 2003 to 2008 because of economy situation and it cost alot to do that. Once I got the CheckBox in DataGrid sorted out, I will definitely post the scripts here to share with everyone who may having the same problem.
__________________
Cheers, Lennie |
|
#6
|
||||
|
||||
|
I stumbled across this and it looks like it is for 2003
http://www.codeproject.com/KB/aspnet...eckboxcol.aspx
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
|
#7
|
||||
|
||||
|
I wasn't even looking for this and I found something else.
http://msdn.microsoft.com/en-us/libr...mn(VS.71).aspx
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
|
#8
|
|||
|
|||
|
Hi Hack,
Thanks for sharing the URL link with me. I will have a look at it and hoping that if there are sample script it's not based on ASP.NET application and will be C#Net2003 Window Application based. Thanks again and you are a awesome helper.
__________________
Cheers, Lennie |
|
#9
|
||||
|
||||
|
Anything else I find specific to 2003 I'll either post or bookmark.
(Have you/your company looked into the free Express versions of VB.NET?)
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
|
#10
|
|||
|
|||
|
Hi Hack,
Neither my Employer or me even looked at Free Express Vb.Net. I have used Vb Express in VB.Net 2005 but have not heard of Free Express.
__________________
Cheers, Lennie |
|
#11
|
||||
|
||||
|
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
|
#12
|
|||
|
|||
|
Hi Hack,
Thanks for your information. Our main development software is C#.Net 2003 for Window Based Application and still struggling with the script for adding CheckBox into all the rows in DataGrid. This Checkbox does not refer to rely on the TBlCustomer field name.
__________________
Cheers, Lennie |
|
#13
|
|||
|
|||
|
Hi Hack,
Finally, I got the C#.NET 2003 Window Application script working. Thanks to all the helper for sharing your knowledge with me. You guys and this Forum are just awesome. I am posting this scrpt here to help newbies just like me who is facing the same problems:- Code:
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();
}
}
/* ------------------------------------------------------------------ */
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);
}
__________________
Cheers, Lennie Last edited by Hack; 11-10-2009 at 07:27 AM. Reason: Added Code Tags |
|
#14
|
||||
|
||||
|
Thanks for posting your resolution Lennie (I edited your post and added the [code]your code goes here[/code] tags for clarity).
You could easily become this site's "Go To" guy for anything related to VS 2003! (And I'm not joking! )
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
|
#15
|
|||
|
|||
|
Hi Hack,
Althought I am a newbie is using C#.Net 2003 I don't mind sharing my scripts with other newbies. You guys have shown very good example for me to follow as well.
__________________
Cheers, Lennie |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [VS03] Datagrid Checkbox Problem | zhixuen | ASP.NET | 4 | 02-16-2009 09:45 AM |
| Enable and Disable Checkbox in Datagrid | Brian | ASP.NET | 2 | 07-16-2008 03:43 PM |
| Add or delete rows from the dataGrid | software_develo | .NET | 1 | 12-27-2005 06:28 AM |
| Datagrid And Checkbox | whygh | VB Classic | 5 | 06-30-2005 02:20 PM |
| CheckBox Column in a DataGrid ? | Jim H | .NET | 1 | 06-11-2001 07:14 AM |