Hi, In my summary dialog, For my bool column, i want to enable only count checkbox, others should be disabled. I could able to hide and visible false the checkboxes, but i couldn't able to disable. This is my sample code,
foreach (Control currentControl in e.SummaryDialog.Controls[0].Controls) { if (currentControl is CheckBox) { if (e.Column.DataType.Equals(typeof(System.Boolean)) && (!currentControl.Text.Equals("Count")) { currentControl.Enabled = false; //currentControl.Visible = false } } }
Please tell me whats wrong with that code and what i have to do, to disable checkboxes.
Regards, Micky
Hi
plz try this code as i have tried and found the solution
foreach (Control currentControl in e.SummaryDialog.Controls[0].Controls[0].Controls[1].Controls) { if (currentControl.Text.Equals("Count")) { currentControl.Enabled = false; currentControl.Visible = false; } }
You can set
DirectCast(currentControl, Windows.Forms.CheckBox).AutoCheck = False
The CheckBox is enabled but click doesn't have effect.
Like i said, I'm not sure it's possible to do this. But I beleive the event gives you a reference to the dialog, itself. So you could hook events on that dialog - it's just a form like any other. I would try events like Form_Shown. If that doesn't work, try the Paint event of the form. You could set the enabled states of the checkboxes inside the Paint event the first time it fires and then unhook the event, so the code doesn't keep getting called.
i am using "BeforeSummaryDialog" event for do this operation. Using this event i could hide or visible false the checkboxes, but can't disable the checkbox. Please guide me which event i can use
Hi Micky,
My guess is that the checkboxes enabled state it being set by the dialog after you set it. So it may not be possible to do this.
What event did you put this code in? Perhaps there is another event you could use that occurs after the enabled states have been set.