关于Repeater中使用DorpWownList的问题
关于Repeater中使用DorpWownList的问题
前台:
<asp:Repeater ID="Repeater1" runat="server" onitemcommand="Repeater1_ItemCommand" onitemdatabound="Repeater1_ItemDataBound">
<asp:DropDownList ID="Curriculum1" runat="server">
<asp:ListItem>大专</asp:ListItem>
<asp:ListItem>本科</asp:ListItem>
<asp:ListItem>博士</asp:ListItem>
<asp:ListItem>硕士</asp:ListItem>
</asp:DropDownList> </asp:Repeater>
后台
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
//Response.Write();
DataRowView drv = (DataRowView)e.Item.DataItem;
DropDownList UsCurr = e.Item.FindControl("Curriculum1") as DropDownList;
string UsCurrVal= drv["userCurriculum"].ToString();
UsCurr.SelectedValue = UsCurrVal;
//string haveimg = drv["userCurriculum"].ToString();
//Response.Write(haveimg);
}
说明:在Repeater的ItemDataBound事件中进行获取值
谨此献给苦苦查找资料的我,希望能帮到后来人。
谨此献给苦苦查找资料的我,希望能帮到后来人。

浙公网安备 33010602011771号