I''ve got 2 grids with pushbuttons, and I''d like to enable/disable these from one another. I.e. clicking on PushButton1 in Grid1 would enable PushButton2 in Grid2.
I can get to the PushButton that fired the event through the EventArgs as in
private void AddRange_CellButtonClicked(object sender, GridCellButtonClickedEventArgs e)
but how would I do this from another PushButton''s event?
thanks,
tom
AD
Administrator
Syncfusion Team
June 7, 2006 08:35 AM UTC
Hi Tom,
Could you try this code to enable pushbutton in a cell. Here is a code snippet.
////Try this code in CellButtonClicked event handler.
GridControl grid = sender as GridControl;
string Name = grid.Name;
if( Name.Equals("gridControl1"))
{
this.gridControl2[e.RowIndex,e.ColIndex].Enabled = false; //False For disable; True for Enable
}
else
{
this.gridControl1[e.RowIndex,e.ColIndex].Enabled = false; //False For disable; True for Enable
}
Here is a sample.
http://www.syncfusion.com/Support/user/uploads/GridPushButtonEnabled_ffe1ffd4.zip
Please let me know if this helps.
Best Regards,
Haneef
TT
Tom Tabruyn
June 7, 2006 09:56 AM UTC
Even after setting
this.gridControl1[e.RowIndex,e.ColIndex].Enabled = false;
the PushButton remains active (clickable, same look), and the CellButtonClicked event handler keeps getting fired.
TT
Tom Tabruyn
June 7, 2006 09:59 AM UTC
maybe important info: we''re using v2.1.0.9
AD
Administrator
Syncfusion Team
June 7, 2006 10:10 AM UTC
Hi Tom,
Try this code to disable the CellbuttonClick event in a push button cell. Here is a code snippet
//For different look and Feel of the Enabled/Disable Pushbutton text
this.gridControl1.TableStyle.Description = "Click";
this.gridControl2.TableStyle.Description = "Click";
this.gridControl2[e.RowIndex,e.ColIndex].Clickable= false;
Best Regards,
Haneef
TT
Tom Tabruyn
June 7, 2006 12:25 PM UTC
yup - that did it.
Thanks!