【发布时间】:2012-06-25 19:07:52
【问题描述】:
我想在数据列表中绑定选中的复选框行..使用此代码但不绑定所有记录..
System.Web.UI.WebControls.CheckBox chkb = new System.Web.UI.WebControls.CheckBox();
string chkBoxIndex = string.Empty;
foreach (C1.Web.Wijmo.Controls.C1GridView.C1GridViewRow row in C1GridView1_listview.Rows)
{
chkBoxIndex = (string)C1GridView1_listview.DataKeys[row.RowIndex].Value.ToString();
chkb = (System.Web.UI.WebControls.CheckBox)row.FindControl("chkBxSelect");
if (chkb.Checked == true)
{
cmd = new SqlCommand("select sample_code,convert(varchar(10),purchase_date,101) as purchase_date,sample_image_id,sample,image,style,descript from sample_shopping,sample_image where sample_shopping.sample_code=sample_image.sample and type='IMG' and sample_code='" + chkBoxIndex + "'", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Close();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
dl_search.DataSource = dt;
dl_search.DataBind();
con.Close();
}
}
【问题讨论】:
-
仅最后一条记录绑定..如何绑定datalist中的更多记录
-
如何使用此代码在 datlist 中绑定多行\
-
jadarnel27//// 你能解决这个问题吗?
-
您是否将复选框的自动回发属性设置为 true?
-
是的不是问题...我的问题是如何添加多个记录绑定数据列表
标签: asp.net ajax web-services c#-4.0