Jump to content

Recommended Posts

Posted

I am trying to rustle up a grid of radiobuttons in c# which will work in both horizontal and vertical groups.

 

So, if a person chooses one of the radiobuttons in a row, it will work like normal with the rest of that row.

 

However, I then want all the other rows to disable the ability to use the radio button in that column from being chosen.

 

Is there an easy-ish way of doing this?

Posted

Is this a kind of multiple choice style exercise?

 

I suppose you could arrange the radio buttons in rows then upon a selection of a button disable the others in that particular column?

Posted
Is this a kind of multiple choice style exercise?

 

I suppose you could arrange the radio buttons in rows then upon a selection of a button disable the others in that particular column?

 

The other thing is, the number of columns/rows will be determined dynamically from the import of data. So, if the data has 10 different columns, there will be 10 rows, and 10 columns (well, 11, as 'not in heirachy' will be one too).

 

Its for dynamically importing people into the active directory, creating OUs based on the options in the radio buttons etc... So, if 'year' is a column, and 'reg group', then year could be selected as the top most OU to group by, then reg group etc... with any which aren't OUs left as 'not in heirachy' to be used to assign values to new user objects.

Posted

Time to try out the new tables feature of CKEditor (in advanced posting)

 

Is this kind of what you mean?

[TABLE=class: grid]

[TR]

[TD]{radio selected}[/TD]

[TD]{radio enabled}[/TD]

[TD]{radio enabled}[/TD]

[/TR]

[TR]

[TD]{radio}[/TD]

[TD]{radio disabled}[/TD]

[TD]{radio disabled}[/TD]

[/TR]

[TR]

[TD]{radio}[/TD]

[TD]{radio disabled}[/TD]

[TD]{radio disabled}[/TD]

[/TR]

[/TABLE]

 

Trying to visualise it.

Posted
It is difficult to visualise what you need, could the same be accomplished with a listbox with tickboxes enabled?
Posted

[TABLE=class: grid]

[TR]

[TD]{radio selected}[/TD]

[TD]{radio}[/TD]

[TD]{radio}[/TD]

[/TR]

[TR]

[TD]{radio}[/TD]

[TD]{radio selected}[/TD]

[TD]{radio}[/TD]

[/TR]

[TR]

[TD]{radio}[/TD]

[TD]{radio}[/TD]

[TD]{radio selected}[/TD]

[/TR]

[/TABLE]

 

Like that, so no column can have 2 enabled, and no row can have 2 enabled.

 

And @Jamo - no I couldn't. As a listbox wouldn't be able to have both multi-columns and checkboxes etc...

Posted (edited)

I'm just trying to imagine this off the top of my head so no code, but could you use the 'Tag' property of each radio button to store it's row and colum ID's (simple CSV format), and also store each radio button object in an array upon creation, then create a sub routine which upon update of the radio button's state, cycles through the array checking for any in the same column/row and disabling them if they're enabled, possibly returning a message to the end user if a clashing button is found to be currently selected?

 

EDIT: alternatively, you could use a multi-dimensional array to store each object, it's row number and it's column number rather than the 'Tag' property, would probably be more efficient

Edited by LosOjos
Posted
Like that, so no column can have 2 enabled, and no row can have 2 enabled.

 

And @Jamo - no I couldn't. As a listbox wouldn't be able to have both multi-columns and checkboxes etc...

 

Sorry I think I misinterpreted your original requirements somewhat!

 

I have certainly not heard of an automated control which can be used in this form, I would think that a Radiobuton would be too restrictive with its automatic grouping functions and that a tickbox with custom actions assigned to it would be the simplest solution to the problem.

 

I would agree with @Los0jos that an multidim array of boolean values created on form creation (or import of the data) would be simplest and then on click of the controls do a manual iteration through the array values to ensure that the conditions are met for the tickbox to be enabled.

Posted
Does it have to be a radio button? Any kind of table thingy makes me think of DataGridViews which are ever so handy at times and they support a CheckBox type.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...