User (Old forums)MemberOctober 12, 2005 at 7:59 amPost count: 23064
Little over a year ago ”Odi” stated in this discussion forum that new editor controls would be released, so that adding a button to a cell in a grid would become easier. Since this has not yet happened I tried to apply Odi’s example to create a column of buttons in my databound grid. I can’t seem to get it to work however. The grid is bound to an array that an object exposes. One of the columns contains true/false values. I would like to exchange the “true” occurences with buttons that the user can press.
Here is the code I tried according to Odis example (http://www.xceedsoft.com/Forums/ShowPost.aspx?PostID=1462):
//show the true/false column
System.Windows.Forms.Button btn = new System.Windows.Forms.Button();
btn.Click += new EventHandler( btn_Click );
//set CellEditor to our new button
grid1.Columns.CellEditor = new Xceed.Grid.Editors.CustomEditor(btn ,”PD”, true);
//set CellViewer so that a button is shown in the cell
grid1.Columns.CellViewer = new Xceed.Grid.Editors.ControlViewer( new System.Windows.Forms.Button(), “Text” );
The row “grid1.Columns.CellEditor = new…” causes an error to be thrown. The error is “A property of the specified name does not exist on the control.\r\nParameter name: propertyName”.
Could you please tell me what I am doing wrong? Perhaps there is a much easier way of adding a button to a cell??
Imported from legacy forums. Posted by kaison (had 3956 views)Odi [Xceed]SpectatorOctober 12, 2005 at 11:46 amPost count: 426
Just so you know, it is coming soon. In November we should have a completed version of Xceed Grid for .NET with the new Editors built-in, though it will not yet be released until another major feature is completed – so it will probably be available for testing by customers.
Imported from legacy forums. Posted by Odi [Xceed] (had 263 views)Xceed SupportMemberOctober 12, 2005 at 11:46 amPost count: 5658
“PD” is not a valid property name for the WindowsForms Button control. If you use “Text”, the exception should be resolved.
Imported from legacy forums. Posted by Jenny [Xceed] (had 370 views)User (Old forums)MemberOctober 17, 2005 at 2:27 amPost count: 23064
Your answer solved my problem. Thank you! I am now able to display a button in the cell where the databound value is “true”. I cannot, however, seem to show another text (caption) on the button than the actual cell value, which is “true”. I would like to show some other text on the button instead. Do you know what the problem might be?
Imported from legacy forums. Posted by kaison (had 315 views)User (Old forums)MemberOctober 17, 2005 at 3:36 amPost count: 23064
If you use the “Enabled” property instead of the “Text” property, the button will be enabled for cells that contain <i>true</i> and disabled for cells that contain <i>false</i>.
Imported from legacy forums. Posted by Tommy (had 388 views)User (Old forums)MemberNovember 6, 2005 at 12:55 pmPost count: 23064
I must be doing something wrong. The buttons show in the row correctly but when I click one, the program shuts down. I have attached a click event to the button and the event fires, but once the event is done, the program just ends. Here is the code:
AddHandler btn.Click, AddressOf MailMergeButton
Private Sub MailMergeButton(ByVal sender As Object, ByVal e As EventArgs)
Dim mailmergeForm As New frmMailMerge
After the form closes, the entire program shuts down.
Any help would be greatly appreciated!
Imported from legacy forums. Posted by twlichty (had 5035 views)
- You must be logged in to reply to this topic.