troubleshooting Question

Adding a Button to a DataGrid in C# Winforms

Avatar of tbailey922
tbailey922 asked on
C#
4 Comments1 Solution9594 ViewsLast Modified:
Hello,
   I have this datagrid that needs to show a regular column, and columns with a checkbox, button and combobox.  I have everything but the button added.  Below is my code.  I looked at syncfusion but it shows a different way of doing it, I can't seem to figure it out.  Plz Help!

pipeLineGridTableStyle = new DataGridTableStyle();
objPipeLineCM = (System.Windows.Forms.CurrencyManager)this.BindingContext[PipeLineDs.Tables[0]];

pipeLineGridTableStyle.MappingName = "PipeLine";

pipeLineGridTableStyle.GridColumnStyles.Add(new DataGridTextBoxColumn(objPipeLineCM .GetItemProperties()["ACAPS#"])); pipeLineGridTableStyle.GridColumnStyles[0].MappingName = "ACAPS#";
pipeLineGridTableStyle.GridColumnStyles[0].HeaderText = "ACAPS#";
pipeLineGridTableStyle.GridColumnStyles[0].Alignment = HorizontalAlignment.Left;
pipeLineGridTableStyle.GridColumnStyles[0].ReadOnly = true;
pipeLineGridTableStyle.GridColumnStyles[0].NullText = string.Empty;
            
pipeLineGridTableStyle.GridColumnStyles.Add(new DataGridBoolColumn(objPipeLineCM .GetItemProperties()["Customer_accept"]));
pipeLineGridTableStyle.GridColumnStyles[1].MappingName = "Customer_accept";
pipeLineGridTableStyle.GridColumnStyles[1].HeaderText = "Customer Accept";

pipeLineGridTableStyle.GridColumnStyles.Add(new DataGridComboBoxColumn(DeclineDT,0,0));
pipeLineGridTableStyle.GridColumnStyles[2].MappingName = "Decline_Code";
pipeLineGridTableStyle.GridColumnStyles[2].HeaderText = "Decline_Code";
pipeLineGridTableStyle.GridColumnStyles[2].Alignment = HorizontalAlignment.Left;
pipeLineGridTableStyle.GridColumnStyles[2].NullText = string.Empty;

//pipeLineGridTableStyle.GridColumnStyles.Add(new DataGridTextButtonColumn(objPipeLineCM .GetItemProperties()["button"]));
//pipeLineGridTableStyle.GridColumnStyles[3].MappingName = "button";
//pipeLineGridTableStyle.GridColumnStyles[3].HeaderText = "Details";

this.dgPipeLine.DataSource = PipeLineDs;
this.dgPipeLine.DataMember = "PipeLine";
this.dgPipeLine.TableStyles.Add(this.pipeLineGridTableStyle);


Thanks
Tim
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros