Can conditional logic be put on a data bound radio button list in ASP C#?

Hello
  I have a radio button list that I am trying to accomplish two tasks with.
First, if another field in that data row is equal to "-", I want this row to appear in the radio button list without an actual button as a non-selectable item.  Second, I want each row to be indented based another value in the table.  

The code for my radio button is:

<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource5"
            DataTextField="Application" DataValueField="InventoryNbr" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged" AppendDataBoundItems="True" RepeatLayout="Flow">
        </asp:RadioButtonList></td>
and the code behind is

  protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
    {
     
    }

Is this even possible?  I've been able to get it to work in ColdFusion, but cannot get it in ASP C#.
Thank you in advance.
reedsster1Asked:
Who is Participating?
 
reedsster1Connect With a Mentor Author Commented:
Just for clarification, in the desired output picture, all results are part of the query.  I am able to make them appear as just bold headers in Coldfusion with no radio button, but not in ASP.
Thanks again for any help.
 
0
 
Bob LearnedCommented:
I don't believe that the RadioButtonList supports separator bars natively.  You might be able to adjust the behavior with a control adapter.

CSS Friendly Control Adapters
http://cssfriendly.codeplex.com/SourceControl/list/changesets
0
 
williamcampbellCommented:
Have you considered using a DataGrid and individual Radio buttons instead? It would be much easier to arrange the buttons that way. I believe each RadioButton has a Group ID that controls their selected status.

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
reedsster1Author Commented:
I might not be describing this well.  I've attached an image of what I'm getting, and and image of the result I want.  I'm not looking to change the selectable status, I don't want a radio button next to it period.  I've added a couple of images to
ColdFucsion.bmp
0
 
reedsster1Author Commented:
Here are what it displays currently in ASP
ASP.bmp
0
 
williamcampbellConnect With a Mentor Commented:
The reason I was suggesting a Datagrid is you can achieve the above list by checking each returned row and dynamically creating a radio button or a label based on the row value.

So you have a single Celled Datagrid

[ Radio 1]
[ Label  ]
[ Radio 2]
[ Radio 3]

You template the DataGrid to have No borders etc and you can indent the label. You can also add tags 'On Sale Now!' etc

Otherwise you might have to subclass the RadioButtonList ...there might be something out there already.

0
 
reedsster1Author Commented:
The number of radio buttons and labels is indeterminate and I want to to be conditional.  Can I use conditional logic in the main code?  I've always just done it in the code behind class?
0
 
Bob LearnedCommented:
That looks like a better job for a Repeater, with conditional logic for the RadioButton controls...
0
All Courses

From novice to tech pro — start learning today.