使用foreach获取Repeater数据

mca*_*ara 2 c# asp.net repeater

我的页面中有一个Repeater,在数据绑定之后,我必须单击一个按钮才能在页面中回发,我需要foreach在Repeater中执行所有数据.在真实中,我必须将每个项目foreach作为示例.

foreach (RepeaterItem itemEquipment in rptSpecialEquipments.Items)
{
   // Get Data From My Repeater
}
Run Code Online (Sandbox Code Playgroud)

最好的祝福,

MiltonCâmaraGomes

gab*_*ira 5

这是你想要的吗?

    foreach (RepeaterItem itemEquipment in rptSpecialEquipments.Items)
    {
        //to get the dropdown of each line
        DropDownList yourDropDown = (DropDownList)item.FindControl("the name of your dropdown control here");

        //to get the selected value of your dropdownlist
        string value = yourDropDown.SelectedValue;
    }
Run Code Online (Sandbox Code Playgroud)