Link to home
Start Free TrialLog in
Avatar of wsturdev
wsturdevFlag for United States of America

asked on

Hide/Show or Enable/Disable radiobuttons in datagrid column

I have a datagrid.  Column 3 has 2 radio buttons aligned vertically.  Depending on values in a hidden column, I want the set of radio buttons in column 3 to either show or not show.  One row might have them showing and the next row might have them hidden.

Is this possible?  If so, how do I do it from VB code?  Or is it better done in ASP?

Alternatively, I could always have them showing but have them either enabled or disabled.
ASKER CERTIFIED SOLUTION
Avatar of hatem72
hatem72

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wsturdev

ASKER

The radio buttons are always in column 3.

I want them to show/enable in row 1 of column 3 and the hide/disable in row 2 of column 3, depending upon a value in a hidden column 1, say.

The column itself will always be visible, while the radio buttons might or might not be visible, depending on the value for that row in the hidden column.
Avatar of hatem72
hatem72

Hi wsturdev,


why dont you use ComboBox insted of radio buttons ???
Because the customer prefers a set of radio buttons, if possible.  I can resort to combobox if necessary, but only if I positively not use radio buttons.
But, even with a combobox, can I hide it/show it in different rows based on a value?
Hi Again,

it was just a suggestion ... BUT the Customer always right

with ComboBox you can add None,Yes,No [ None like Select nothing]

check this:
http://msdn2.microsoft.com/en-us/library/ms171619.aspx

Hope this work with you .
I am awarding you the points because your responses spurred some analysis and I found an answer.  Rows either have the radiobuttons enabled or disabled based on a value from a hidden column.

Here is my solution, for the record:

        Dim iRow As Integer
        Dim iRowsToScan As Integer
        iRowsToScan = QuestionDataGrid.Items.Count
        For iRow = 0 To iRowsToScan - 1
            'Enable/Disable Yes-No
            If QuestionDataGrid.Items(iRow).Cells(6).Text = True Then
                QuestionDataGrid.Items(iRow).Cells(3).Enabled = True
            Else
                QuestionDataGrid.Items(iRow).Cells(3).Enabled = False
            End If
        Next

Thanx for the points ... and i hope you make your Customer pleased ... ;)