gridview的一些小问题

一不用就喜欢忘,哪怕再小也要把你记下来~!!!

///在gridview中dropdownlist自行更新所的方法

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl = (DropDownList)sender;///获取控件
            int sel = int.Parse(ddl.SelectedItem.Value);
            //TableCell cell = (TableCell)ddl.Parent;
            //GridViewRow grv = (GridViewRow)cell.Parent;
            GridViewRow grv = (GridViewRow)ddl.Parent.Parent;//获取当前操作列的列值
            if (grv != null)
            {
                int TID = int.Parse(grv.Cells[0].Text);///当前列的第一单元,取ID
                BLL.GameInfo bll = new SFCMS.BLL.GameInfo();
                bll.Update(TID, sel);
            }
        }

posted on 2009-02-16 10:32  skeeter  阅读(118)  评论(0编辑  收藏  举报

导航