?
Solved

Hide/Show or Enable/Disable radiobuttons in datagrid column

Posted on 2007-08-11
9
Medium Priority
?
186 Views
Last Modified: 2008-03-06
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.
0
Comment
Question by:wsturdev
  • 5
  • 4
9 Comments
 
LVL 6

Accepted Solution

by:
hatem72 earned 2000 total points
ID: 19677119
Hi,

  Hide/Show or Enable/Disable :
       YourGrid.Columns(3).ReadOnly = False
        YourGrid.Columns(4).Visible = False
0
 
LVL 1

Author Comment

by:wsturdev
ID: 19677281
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.

0
 
LVL 1

Author Comment

by:wsturdev
ID: 19677303
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:hatem72
ID: 19677338
Hi wsturdev,


why dont you use ComboBox insted of radio buttons ???
0
 
LVL 1

Author Comment

by:wsturdev
ID: 19677344
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.
0
 
LVL 1

Author Comment

by:wsturdev
ID: 19677346
But, even with a combobox, can I hide it/show it in different rows based on a value?
0
 
LVL 6

Expert Comment

by:hatem72
ID: 19677374
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 .
0
 
LVL 1

Author Comment

by:wsturdev
ID: 19677474
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
0
 
LVL 6

Expert Comment

by:hatem72
ID: 19677484

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question