Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > .NET

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-30-2009, 06:32 PM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
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.
Reply With Quote
  #2  
Old 11-03-2009, 08:55 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
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
Reply With Quote
  #3  
Old 11-03-2009, 03:23 PM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
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.
Reply With Quote
  #4  
Old 11-03-2009, 03:31 PM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
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
Reply With Quote
  #5  
Old 11-03-2009, 03:45 PM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
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
Reply With Quote
  #6  
Old 11-04-2009, 08:55 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
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
Reply With Quote
  #7  
Old 11-04-2009, 10:59 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
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
Reply With Quote
  #8  
Old 11-04-2009, 04:37 PM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
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
Reply With Quote
  #9  
Old 11-05-2009, 08:48 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
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
Reply With Quote
  #10  
Old 11-05-2009, 09:14 PM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
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
Reply With Quote
  #11  
Old 11-06-2009, 08:25 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
I was referring to VB 2008 Express Edition

http://www.microsoft.com/exPress/download/
__________________
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
Reply With Quote
  #12  
Old 11-06-2009, 10:47 PM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
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
Reply With Quote
  #13  
Old 11-09-2009, 11:58 PM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
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
Reply With Quote
  #14  
Old 11-10-2009, 07:30 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
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
Reply With Quote
  #15  
Old 11-10-2009, 10:39 PM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
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
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT -4. The time now is 08:09 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.