Web User Control, Repeater, Databound, add radio button(s), select

Discussion in 'ASP .Net Web Controls' started by Eskimo, Feb 22, 2005.

  1. Eskimo

    Eskimo Guest

    Hi,

    I had a similar question that was answered with a linkbutton; now I need
    the functionality of a radiobutton inside of a databound repeater where
    you select one row; now how do I get to the radio button that's selected and
    ensure that only one row is selected (it's a pick/choose one at a time type
    of thing)...

    Thanks!

    what I have:

    control:

    <%@ Control Language="c#" AutoEventWireup="false"
    Codebehind="CoursesRadioButton.ascx.cs"
    Inherits="HSTM.HAC.Course.Exchange.Web.Controls.CoursesRadioButton"
    TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
    <HTML>
    <HEAD>
    <link href="../style/ac_style.css" type="text/css" rel="stylesheet">
    </HEAD>
    <asp:Repeater id="CoursesRepeater" runat="server">
    <HeaderTemplate>
    <table id="tblCourses" class="" cellspacing="4" cellpadding="4"
    width="100%">
    <tr style="background-color:#E0E0E0">
    <td></td>
    <td>courseId</td>
    <td>courseTitle</td>
    <td>courseLocation</td>
    <td>createDt</td>
    <td>updateDt</td>
    <td>liveDt</td>
    <td>importsPending</td>
    </tr>
    </HeaderTemplate>
    <ItemTemplate>
    <tr style="background-color:#F0F0F0">
    <td><input type="radio" name='rad' value='<%#
    DataBinder.Eval(Container.DataItem,"courseId") %>' runat="server"></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"courseId") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"courseTitle") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"courseLocation") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"createDt") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"updateDt") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"liveDt") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"importsPending") %></td>
    </tr>
    </ItemTemplate>
    <AlternatingItemTemplate>
    <tr style="background-color:#E0E0E0">
    <td><input type="radio" name='rad' value='<%#
    DataBinder.Eval(Container.DataItem,"courseId") %>' runat="server"></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"courseId") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"courseTitle") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"courseLocation") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"createDt") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"updateDt") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"liveDt") %></td>
    <td align="left"><%#
    DataBinder.Eval(Container.DataItem,"importsPending") %></td>
    </tr>
    </AlternatingItemTemplate>
    <FooterTemplate>
    </table>
    </FooterTemplate>
    </asp:Repeater>
    <br>
    <asp:Button id="cmdShowCourseIdSelected" runat="server" Text="Show
    Course Id Selected"></asp:Button>
    </HTML>


    --
    tym, Eskimo
    Eskimo, Feb 22, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rodchar
    Replies:
    0
    Views:
    393
    rodchar
    Nov 26, 2007
  2. debartsa
    Replies:
    1
    Views:
    343
    John Saunders
    Apr 9, 2004
  3. Sriram

    how to add single select radio button in datagrid... URGENT

    Sriram, Jun 8, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    164
    Alvin Bruney [MVP]
    Jun 9, 2004
  4. Hiten
    Replies:
    1
    Views:
    620
    Vidar Petursson
    May 26, 2004
  5. Manu
    Replies:
    0
    Views:
    166
Loading...

Share This Page