实现后效果如 http://www.66law.cn/user/register_lawyer.aspx
请问:如何得到CheckBoxList中用户所选择项的值?以下是我的做法,请高手解答!
前台:
<asp:repeater id="Repeater1" runat="server">
<ItemTemplate>
<table>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem,"S_title")%>
</td>
</tr>
<tr>
<td>
<asp:CheckBoxList id="cblaw" runat="server"></asp:CheckBoxList>
</td>
</tr>
</table>
</ItemTemplate>
</asp:repeater>
后台:
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
BindReapt();
}
}
private void BindReapt()
{
DataSet ds=obj.GetBspecialty();
Repeater1.DataSource =ds;
Repeater1.DataBind ();
ds.Dispose();
}
private void Repeater1_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
{ //绑定checkboxlist
CheckBoxList cb=(CheckBoxList)e.Item.FindControl("cblaw");
DataRowView row=(DataRowView)e.Item.DataItem;
string root=row["S_title"].ToString();
DataSet DS=obj.GetSspecialty(root);
cb.DataSource=DS;
cb.DataTextField="S_title";
cb.DataValueField="S_id";
cb.DataBind();
}
现在问题是怎么样取得用户所选择的项目值?