带多标题的嵌套Gridview [英] Nested Gridview with multi header

查看:68
本文介绍了带多标题的嵌套Gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在嵌套Gridview中,父Gridview应该将ID传递给子GridView.子Gridview应该显示带有多标题(标题然后是子标题)的数据.

任何有想法的人.

帮助资料.

谢谢

Praveena

Hi all,

In Nested Gridview, The Parent Gridview should pass an Id to Child GridView. The Child Gridview should display data with Multi Header(header then sub header).

Anybody having an idea.

Help Pl.

Thanks

Praveena

推荐答案



对于嵌套网格显示查询,请查看以下链接

http://mosesofegypt.net/post/2008/02/24/Building-a-grouping-Grid-with-GridView-and-ASPNET-AJAX-toolkit-CollapsiblePanel.aspx [
Hi,

For nested grid display query have a look on the following link

http://mosesofegypt.net/post/2008/02/24/Building-a-grouping-Grid-with-GridView-and-ASPNET-AJAX-toolkit-CollapsiblePanel.aspx[^]


To have multiple headers in your grid try the following code.


protected void gvEmployee_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                GridView oGridView = (GridView)sender;
                GridViewRow oGridViewRow = new GridViewRow(0, 0,
                            DataControlRowType.Header, DataControlRowState.Insert);
                TableCell oTableCell = new TableCell();

                oTableCell.Text = "Employee Details";
                oTableCell.ColumnSpan = 9;
                oGridViewRow.Cells.Add(oTableCell);
                oTableCell.CssClass = "header";
               
                oGridView.Controls[0].Controls.AddAt(0, oGridViewRow);
            }
        }



如果您想要如下所示的标头.

装扮
X Y Z


然后




if you want a header like as follows.

Deparments
X Y Z


then


protected void gvEmployee_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                GridView oGridView = (GridView)sender;
                GridViewRow oGridViewRow = new GridViewRow(0, 0,
                            DataControlRowType.Header, DataControlRowState.Insert);
                TableCell oTableCell = new TableCell();

                oTableCell.Text = "Departments";
                oTableCell.ColumnSpan = 3;
                oGridViewRow.Cells.Add(oTableCell);
                oTableCell.CssClass = "header";
               
                oGridView.Controls[0].Controls.AddAt(0, oGridViewRow);
            }
        }



希望这会有所帮助.



Hope this helps.


这篇关于带多标题的嵌套Gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆