retrieving a value from data bound to a repeater
I have a repeater with some data bound to it...this repeater has 2 controls in it. The bound data for the repeater would look something like this
Name ID
New 16
Old 24
Sold 18
What I need to do in my code behind is grab the "ID" value for each row; put that value into a variable; retrieve some data; and bind it to a drop down. My question is how do I retrieve the "ID" value from the data that is bound to the repeater?
So something like
RepeaterItem r = e.Item;
foreach(Control c in r.Controls)
{
int ID = "value from the ID column that is bound to the repeater control" (How do I get this value???)
if(c is System.Web.UI.WebControls.DropDownList)
{
((DropDownList) c).DataSource =
source.table.Select("iD = 221"); <<<<(REPLACE "iD=221" WITH VARIABLE VALUE "ID")
((DropDownList) c).DataMember = "value";
((DropDownList) c).DataTextField = "value";
((DropDownList) c).DataBind();
}
}
Thanks,
Bill
|