Repeater + RadioButtonList

Discussion in 'ASP .Net Building Controls' started by Guldo K, Nov 5, 2005.

  1. Guldo K

    Guldo K Guest

    Hello

    I need some help...
    I have a repeater; its source is a dataview based on a datatable of a
    dataset.
    The aspx page creates a radiobuttonlist for each item in the repeater:
    <asp:Repeater>
    <ItemTemplate>
    <asp:RadioButtonList ... DataSource='<%#
    GetDataView(Databinder.Eval(Container.DataItem, "myField") %>' ... >
    ....

    where GetDataView returns a dataview, based on "myField", and "myField"
    belongs to the first dataview.
    (the DataSource property of the Repeater is set in the C# code)

    Question:
    Whenever the user clicks on an element of a RadioButtonList, I need to
    know which row of the repeater is the current one, that is, what's the
    current value of "myField".
    How can I?

    Thanks ^^

    --
    Guldo
    www.giapponegiappone.it
    Powered by Debian Sid
    Guldo K, Nov 5, 2005
    #1
    1. Advertising

  2. Guldo K

    GJH Guest

    Here is something I did with a datagrid, so it should be very similar. Call
    this in either a button click or autopostback of the radiobutton. Hope this
    helps.



    Dim myDataGridItem As DataGridItem

    Dim chkSelected As System.Web.UI.WebControls.CheckBox

    Dim strPDF As String

    Dim strActive As String

    Dim strNewsID As String

    Dim strDDL As String

    lblStatus.Text = "<br>You selected the Following items:<br><br>"

    For Each myDataGridItem In DataGrid1.Items

    chkSelected = myDataGridItem.FindControl("chkSelection")

    If chkSelected.Checked Then

    strPDF = CType(myDataGridItem.FindControl("lblPDF"), Label).Text

    strActive = CType(myDataGridItem.FindControl("lblActive"), Label).Text

    strDDL = CType(myDataGridItem.FindControl("DropDownList1"),
    DropDownList).SelectedItem.Text

    strNewsID = myDataGridItem.Cells(2).Text

    lblStatus.Text += "The PDFs are: <b>" & strPDF & "</b> "

    lblStatus.Text += "The Actives are: <b>" & strActive & "</b> "

    lblStatus.Text += "The strDDL are: <b>" & strDDL & "</b> "

    lblStatus.Text += " and the NewsIDs are: <b>" & strNewsID & "</b><br>"

    End If

    Next



    "Guldo K" <guldo@no_spam.it> wrote in message
    news:X_5bf.47024$...
    > Hello
    >
    > I need some help...
    > I have a repeater; its source is a dataview based on a datatable of a
    > dataset.
    > The aspx page creates a radiobuttonlist for each item in the repeater:
    > <asp:Repeater>
    > <ItemTemplate>
    > <asp:RadioButtonList ... DataSource='<%#
    > GetDataView(Databinder.Eval(Container.DataItem, "myField") %>' ... >
    > ...
    >
    > where GetDataView returns a dataview, based on "myField", and "myField"
    > belongs to the first dataview.
    > (the DataSource property of the Repeater is set in the C# code)
    >
    > Question:
    > Whenever the user clicks on an element of a RadioButtonList, I need to
    > know which row of the repeater is the current one, that is, what's the
    > current value of "myField".
    > How can I?
    >
    > Thanks ^^
    >
    > --
    > Guldo
    > www.giapponegiappone.it
    > Powered by Debian Sid
    GJH, Dec 6, 2005
    #2
    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. David Davis

    RadioButtonList in a repeater

    David Davis, Oct 21, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,940
    David Davis
    Oct 21, 2003
  2. Ravi
    Replies:
    2
    Views:
    4,412
    jagdish
    Aug 18, 2006
  3. Darren
    Replies:
    1
    Views:
    5,910
    Curt_C [MVP]
    Sep 28, 2004
  4. Rod  Snyder
    Replies:
    1
    Views:
    3,552
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Feb 17, 2005
  5. IFIA
    Replies:
    0
    Views:
    440
Loading...

Share This Page