我已在网页的更新面板中创建了复选框列表,如下所示
在aspx文件中
<asp:UpdatePanel ID="pnlUpdateAgency" runat="server">
...
<asp:CheckBoxList ID="chklLineOfAuthority" RepeatColumns="3" RepeatLayout="Table"
RepeatDirection="Horizontal" AutoPostBack="false" CausesValidation="false" runat="server">
</asp:CheckBoxList>
...
</asp:UpdatePanel>
在aspx.cs文件中
Page_Load(...)
{
...
...
int pid = 2045;
FillLineOfAuthorityForProduct(pid);
}
public void FillLineOfAuthorityForProduct(int productid)
{
DataSet ds = new DataSet();
LineOfAuthorityBL bl = new LineOfAuthorityBL(SessionContext.SystemUser);
bl.FetchAll(ds);
chklLineOfAuthority.DataSource = ds.Tables[bl.SqlEntityX];
chklLineOfAuthority.DataTextField = "LineOfAuthorityX";
chklLineOfAuthority.DataBind();
ds = null;
DataSet dss = new DataSet();
bl.FetchForProductId(dss, productid);
if (dss.Tables[0].Rows.Count > 0)
{
string[] arrGroup = dss.Tables[0].Rows[0]["LineOfAuthorityX"].ToString().Split(',');
foreach (object obj in arrGroup)
{
for (int i = 0; i < chklLineOfAuthority.Items.Count; i++)
{
if (chklLineOfAuthority.Items[i].Value == obj.ToString())
{
chklLineOfAuthority.Items[i].Selected = true;
}
}
}
}
}
现在问题是没有在网页中检查复选框... 请帮帮我!!!