Hello,
I have a repeater control bound to a collection of objects. When I fire off the button_onclick event, I need to have access to the dataitem to get the object properties. Here is what I have and my question is how do I access the underlying objects in a repeater in a button_onclick event
protected void OKButton_Click(object sender, EventArgs e)
{
try
{
string selectedValue = Request.Form["repeaterRadioButton"];
foreach (RepeaterItem item in Repeater1.Items)
{
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
MyObject myObject = (MyObject)item.DataItem;
if (!string.IsNullOrEmpty(selectedValue) && selectedValue == myObject.MyProperty)
{
//stuff in here
} ... rest of code