Items、Rows、Cells

    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

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值