Hey everyone.
I am upgrading my skills into winform development from asp.net and need a little help....I think asp.net is much easier when it comes to grids and data layout....but hey its only early days.
I have created a grid and I am wanting to add a couple of buttons to the right of the actual data however I am struggling...I dont want to use standard buttons I want to use images and have an onclick event on each of them.
My binding class looks like this
Within my win form I have this
If I run the above code it a runs fine....As you can see I have tried adding buttons....
What do I need to do to add the columns.....Ideally when I pressed either of them they would return the selected item ID i.e ItemID
Sorry if this is all asic stuff however still getting my head around win forms
Thank you for your help
I am upgrading my skills into winform development from asp.net and need a little help....I think asp.net is much easier when it comes to grids and data layout....but hey its only early days.
I have created a grid and I am wanting to add a couple of buttons to the right of the actual data however I am struggling...I dont want to use standard buttons I want to use images and have an onclick event on each of them.
My binding class looks like this
public ItemDetail(int itemID, string itemDescription, int itemsRequired) |
{ |
ItemID = itemID; |
itemDescription = itemDescription; |
ItemsRequired = ItemsRequired; |
} |
public int ItemID { get; set; } |
public string ItemDescription { get; set; } |
public int ItemsRequired { get; set; } |
Within my win form I have this
public List<ItemDetail> _itemDetails = new List<ItemDetail>(); |
public MainForm() |
{ |
InitializeComponent(); |
BindItems(); |
} |
private
void BindItms()
{ gridItems.DataSource = _itemDetails;
GridViewCommandColumn addColumn = new GridViewCommandColumn();
addColumn.DefaultText = "Hello";
RadDataGridViewButtonColumn buttonColumn = new RadDataGridViewButtonColumn();
buttonColumn.Text = "Press Me";
this.gridItems.Columns.Add(addColumn);
this.gridItes.CommandCellClick += new CommandCellClickEventHandler(gridItems_CommandCellClick);
} |
If I run the above code it a runs fine....As you can see I have tried adding buttons....
What do I need to do to add the columns.....Ideally when I pressed either of them they would return the selected item ID i.e ItemID
Sorry if this is all asic stuff however still getting my head around win forms
Thank you for your help