当前位置:跳过导航链接计算机毕业设计首页 : 技术应用 : 详细内容

GridView如何获取表脚内容

来源:本站原创 作者:管理员 添加时间:2011-05-11 点击数:1506

1、相关介绍:

在使用GridView时常常要用到表脚内容,下面就来介绍如何设置或获取表脚内容,详见代码如下:

以下是引用片段:

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Footer)
        {          
                string sSql = "select bh from Gjxl";
                SQL s = new SQL();
                ArrayList al = s.arrSearch(sSql);
                for (int i = 0; i < al.Count; i++)
                {
                   DropDownList dd= (DropDownList)(e.Row.FindControl("ssxl1"));//设置GridView每行表脚内容
                   dd.Items.Add(al[i].ToString());
                }
                sSql = "select LoginId from Users where Role='司机'";
                SQL s1 = new SQL();
                al = s1.arrSearch(sSql);
                for (int i = 0; i < al.Count; i++)
                {
                    DropDownList dd = (DropDownList)(e.Row.FindControl("sssj1"));
                    dd.Items.Add(al[i].ToString());
                }           
        }     
    }

<责任编辑:计算机毕业设计网(http://www.xiaoniu168.com)>

第1页

【联系方式】

【本站信誉】

用心做计算机毕业设计论文网