程序是这样的为专家设置所属专家组属性 由于 一个专家可为多个组成员,专家组的个数是变化的,所以使用多选控件
DataList里面绑定CheckBox  从数据库中读出“专家组名称”字段绑定在了checkBox的text属性
这部我已经实现了 ,请问怎么才能做到如果此专家以在这个组时 所称显得Checked属性为false
还有最后怎么样才能得到 用户设置后的Checked的值,我好写回数据库。简单的说 如何设置DataList里面绑定CheckBox的Checked属性,和获取他的Checked属性

解决方案 »

  1.   

    <CheckBox id="XX" checked=<%# DataBinder.Eval(Contaner.DataItem,"Value")%>>
      

  2.   

    StringBuilder sb = new StringBuilder();
    Random rnd = new Random();
    string power;

    for(int i=0;i<20;i++)
    {
    sb.Append("0000000000");
    }
    power=sb.ToString();
                /////
                ///
    CheckBoxList tb;
    int ModuleID;
    DataGridItem  gdi;

    for(int i=0;i<dg_booktype.Items.Count ;i++)
    {
    gdi=dg_booktype.Items[i];
    ModuleID=int.Parse(gdi.Cells[0].Text);
    int MSel=Hugo.BookShop.User.GetSel(ModuleID);
    //获取数量;
    tb = (CheckBoxList)gdi.FindControl("power");
    int Sel=0;
    foreach(ListItem ThisOne in tb.Items)
    {
    if(ThisOne.Selected==true)
    {
    sb.Replace('0','1',MSel+Sel,1);

    }
    Sel++;
    }

    }
    try
    {
    power=sb.ToString();
    Hugo.BookShop.User.UpdatePower(Request.QueryString[ "nodeid"].ToString(),power);
    UpdatePrev(Request.QueryString[ "nodeid"].ToString(),power);
    }
    catch(Exception er)
    {
    ShowErrMsg(er.Message);
    }
    Response.Redirect(ViewState["BackUrl"].ToString());
      

  3.   

    <CheckBox id="XX" checked=<%# DataBinder.Eval(Contaner.DataItem,"Value")%>>
    这种方法在VS2005里很常用,不知道asp.net1.1是否支持--------------------------------------------------------------
    losingrose
    http://seawind.isme.net
    [email protected]
    [email protected]
      

  4.   

    是 dslbill(云风)  的程序看不太明白
      

  5.   

    <CheckBox id="XX" checked=<%# DataBinder.Eval(Contaner.DataItem,"Value")%>>
    ----------------------------------------
    可以
      

  6.   

    tb = (CheckBoxList)gdi.FindControl("power");
    int Sel=0;
    foreach(ListItem ThisOne in tb.Items)
    {
    if(ThisOne.Selected==true)
    {
    sb.Replace('0','1',MSel+Sel,1);

    }
    Sel++;
    }
    判断复选列表选中状态,记录下来。