protected void droppos_SelectedIndexChanged(object sender, EventArgs e)
{
for (int i = 0; i <= this.GridView1.Rows.Count - 1; i++)
{
CheckBox check = (CheckBox)this.GridView1.Rows[i].FindControl("checkedt");
check.Checked = false;
}
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
con.Open();
for (int i = 0; i <= this.GridView1.Rows.Count - 1; i++)
{
try
{
CheckBox check = (CheckBox)this.GridView1.Rows[i].FindControl("checkedt");
string sqltext = "select Visible from User_Right where Position_Code=" + droppos.SelectedValue + " and FormID='" + this.GridView1.Rows[i].Cells[1].Text + "'";
SqlCommand cmd = new SqlCommand(sqltext, con);
//Response.Write(sqltext);
string bb = cmd.ExecuteScalar().ToString();
//Response.Write(bb);
if (bb == "1")
{
check.Checked = true;
}
else
{
check.Checked = false;
}
}
catch
{
}
}
con.Close();
}
GridView中有Item吗?---VS2005
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标经过时,行背景色变
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ECF3E1'");
//鼠标移出时,行背景色变
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
}
}
Items
1。protected void Button1_Click(object sender, EventArgs e) { ArrayList arrayList = new ArrayList(); foreach (ListItem item in ListBox1.Items) { if (item.Selected) { arrayList.Add(item.Value); } } Session["arrayList"] = arrayList; ConfigureCrystalReports(); } 2。CheckBoxList1.Items[1].Value