医药CRM系统开发

自已做医药CRM系统有四年了,终于可以算个产品了,努力市场化,今年重种将医药营销的理念加入CRM

导航

对DataGrid中的ListBox设置值

Posted on 2007-02-28 20:45  hhq80  阅读(163)  评论(0编辑  收藏  举报

   if ( e.Item.ItemType == ListItemType.EditItem )
   {
    DataRowView drv = (DataRowView)e.Item.DataItem;

    SqlCommand com = new SqlCommand("select dm,dmmc from zy_yp1_group order by dmmc");
    com.Connection = conn;
    if (conn.State != ConnectionState.Open )
     conn.Open();
    SqlDataReader dr = com.ExecuteReader();

    ListBox lb = (ListBox) e.Item.Cells[11].Controls[1];
    lb.DataSource = dr;
    lb.DataTextField = "dmmc";
    lb.DataValueField = "dm";
    lb.DataBind();

    dr.Close();
    conn.Close();
   }