Repeater + RadioButtonList

G

Guldo K

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 ^^
 
G

GJH

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top