对GridView的某一列行进行操作。。

 

   protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex > -1)
            {
                DropDownList ddlStatus = e.Row.FindControl("dropDown") as DropDownList;
                ddlStatus.Items.Add(new ListItem("Red", "1"));
                ddlStatus.Items[0].Attributes.Add("style", "background-color: red");
                ddlStatus.Items.Add(new ListItem("Green", "2"));
                ddlStatus.Items[1].Attributes.Add("style", "background-color: Green");
                         }
            LinkButton deletebtn = (LinkButton)e.Row.FindControl("delBtn");
            if (deletebtn != null)
            {
                deletebtn.Attributes.Add("onclick", "return confirm('你确定要删除所选择商品信息?');");
            }
        }

 

posted @ 2015-05-29 09:43  yida_mingzhu  阅读(237)  评论(0编辑  收藏  举报