ASP.Net Global Radio Button in Repeater

Hello Experts,

I am working on an ASP.Net helpdesk application for our company intranet, and am running into a problem.  I am trying to include a radio button in a repeater control, and initially ran into the issue of the radio buttons not being mutually exclusive (ie, I could select more than one).  After doing some checking, I found an article referencing a custom class that would provide the function I need (written by Andy Smith,  I have copied the .dll file to the bin directory in my application's folder, and added the reference to the control in my page.  When I add the GlobalRadioButton control to my page, it now enforces the selection of only one option.  However, when I try to reference the control in a function, it is not available.  I believe this is because it is contained within the repeater control.  How do I reference the GlobalRadioButton control in a function so that I can retrieve its value?  On a broader note, I am a relatively new ASP.Net programmer, with some previous experience in VB 6 and "classic" ASP.  In doing searches for help, I commonly see references to terms like code behind, private void, and others that are unfamiliar.  I am also looking for suggestions on good instructional materials (web sites, books, etc.) to get more up to speed on ASP.Net.  Any and all suggestions are welcome and appreciated!


<%@ Page Language="VB" debug="true"%>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Register TagPrefix="mbwebcont" Namespace="MetaBuilders.WebControls" Assembly="MetaBuilders.WebControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">
    Sub Page_Load(s As Object, e As EventArgs)
        Dim strPassedName, strSupportTech As String
        strSupportTech = Session(strPassedName)
        Dim strGetOpenIssues As String
        Dim conGetOpenIssues As OleDbConnection
        Dim cmdGetOpenIssues As OleDbCommand
        Dim dtrGetOpenIssues As OleDbDataReader
        strGetOpenIssues = "SELECT Request_ID, User_Full_Name, Contact_Number, Issue_Title, Issue_Type, Issue_Impact, Request_Creation_Time FROM "
        strGetOpenIssues = strGetOpenIssues & "tblSupportRequest WHERE Request_Closed = False"
        conGetOpenIssues = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Inetpub\wwwroot\HelpDesk\Database\database.accdb;Persist Security Info=False")
        cmdGetOpenIssues = New OleDbCommand(strGetOpenIssues, conGetOpenIssues)
        dtrGetOpenIssues = cmdGetOpenIssues.ExecuteReader
        rptOpenIssues.DataSource = dtrGetOpenIssues
        conGetOpenIssues = Nothing
        cmdGetOpenIssues = Nothing
    End Sub


<html xmlns="">
<head runat="server">
    <link rel="stylesheet" type="text/css" href="company_helpdesk.css" />
    <form id="frmAddressIssue" runat="server">
    <asp:Table ID="main_table" runat="server" width="650" cellpadding="0" cellspacing="0" border="0" BorderColor="red">
            <asp:TableCell HorizontalAlign="Left" VerticalAlign="Top" CssClass="Text_Normal">
                The issues listed below are all issues that are currently listed as open and unassigned in the database.  The issues are sorted by level of impact and time 
                received.  To accept an issue, select the option marker associated with the issue and click the button labeled "Accept Issue" at the bottom of the screen.  
            <asp:TableCell Height="7" CssClass="Text_Short">&nbsp</asp:TableCell>
                <asp:Repeater ID="rptOpenIssues" runat="server">
                            <table width="650" border="0" bordercolor="blue" cellpadding="3" cellspacing="0" frame="void">
                                    <td colspan="4" class="Text_Normal" align="left">These requested records are shown below.</td>
                                    <td colspan="4" height="5" class="Text_Short">&nbsp</td>
                                    <th class="Text_Normal" align="left" valign="top"><u>Select:</u></th>
                                    <th class="Text_Normal" align="left" valign="top"><u>User:</u></th>
                                    <th class="Text_Normal" align="left" valign="top"><u>Number:</u></th>
                                    <th class="Text_Normal" align="left" valign="top"><u>Issue:</u></th>
                                <td class="Text_Normal" align="left" valign="top">
                                    <mbwebcont:GlobalRadioButton runat="server" ID="radIssues" GlobalGroup="true" GroupName="radAvailIssues"  value='<%#Container.DataItem("Request_ID")%>' />  
                                <td class="Text_Normal" align="left" valign="top"><%#Container.DataItem("User_Full_Name")%></td>
                                <td class="Text_Normal" align="left" valign="top"><%#Container.DataItem("Contact_Number")%></td>
                                <td class="Text_Normal" align="left" valign="top"><%#Container.DataItem("Issue_Title")%></td>
        <asp:Label ID="lblTest" runat="server" CssClass="Text_Normal"></asp:Label>

Open in new window

rdillionSystems AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You have to access it using the FindControl function but you need to have a row reference.

Repeater1.Items(RowIndex).FindControl("controlname").Text = ""
rdillionSystems AdministratorAuthor Commented:
Thanks for the quick reply and help.  By row reference, do you mean I need to find the index number of the row to be selected (ie 0, 1, etc)?  
Yes because the control will be created for each row.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference ithrough the Colors of STEM program.

rdillionSystems AdministratorAuthor Commented:
Thanks again for your help.  I have been trying to get this to work most of the afternoon, with your suggestion and also trying some suggestions found online.
(I realize the code for the code behind page in the online article is written in C, I have tried to convert it to vb).  I am not getting very far.  I understand that I would need to use the FindControl method of the repeater control to determine the identity of the radio button control that I need to reference, and then see if I can get the value of the radio button group, but I am running into a number of problems putting it into practice.  For one, how would I konw the row reference number?  If I have, say, 5 rows each with a radio button, I would not know which row to reference in the code.  Also, when I attempt to read the .Text attribute of the control, I receive a message stating that that attribute does not exist for that control.  I am confident that this can be done, but it is proving quite frustrating for me.  If you have any other ideas on what I am missing, please let me know.
Thanks again,
I used .Text as an example. For radio button it probably would be .Checked property.

Show me your aspx code and I will try to run it in a demo app.

>For one, how would I konw the row reference number?

If you are trying to find out which one is checked, I would imagine you would loop through all the rows and check the radio button in each row to see if its checked.
rdillionSystems AdministratorAuthor Commented:
Hey CodeCruiser,
Thanks again for all of your help and willingness to take a look at the code.  Let me see if I can put it through a loop and make any headway, and I will get back to you a bit later this AM.  If I am still stuck I'll take you up on your offier.  If I can find some success, it will go a long way in helping me learn.
I'll be in touch,
rdillionSystems AdministratorAuthor Commented:
"waves white flag..."
Hey CodeCruiser, I have not made any headway.  I guess I just do not understand the language as well as I need to yet.  All I am trying to do is to pull some information from a database and display it with a mutually exclusive radio button in a repater control, allowing the user to select a row from the list and then when the Submit button is clicked, get a unique value (Request_ID from the database).  If yoiu do have a chance to take a look at this and give any suggestions it would be very much appreciated.  In order to try it, you would also need the custom class dll file referenced in my original post above.  Thanks again very much!
Russ        help-desk.accdb code.txt
rdillionSystems AdministratorAuthor Commented:
btw, I know there is not much in the code in the submit button click subroutine in the way of determining the id of the selected control, etc.  I have truly tried a number of approaches and continue to get errors like "the object is not referenced" and others.  Just didn't want you to think that I haven't tried to work it out.  Thanks
I just tested a simplified version of your code (with asp radio button) and following code works for me

        For i As Integer = 0 To rptOpenIssues.Items.Count - 1
            Dim rb = rptOpenIssues.Items(i).FindControl("radAvailIssues")

To be able to extract any properties, you would need to cast rb to correct type like below

Dim grb As GlobalRadioButton = CType(rb, GlobalRadioButton)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rdillionSystems AdministratorAuthor Commented:
Thank you VERY much!!  I have gotten the page to work as I need it to with your assitance.  I sincerely appreciate your time and help!!
Glad to help :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.