This is a migrated thread and some comments may be shown as answers.

Can RadGridView merge columns and rows???

3 Answers 150 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Starry
Top achievements
Rank 1
Starry asked on 11 Jun 2012, 09:53 AM
Can   RadGridView      merge   columns   and   rows???

Asp.net    contains    "GridView" ,    it  can  do  as  follows...

  protected void GridView_HZ_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.Header:
                    TableCellCollection tcHeader = e.Row.Cells;
                    tcHeader.Clear();
                    //第一行表头
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[0].Attributes.Add("colspan", "13");
                    tcHeader[0].Attributes.Add(" Font-Size", "15");
                    tcHeader[0].Attributes.Add("bgcolor", "#5D7B9D");
                    tcHeader[0].Text = "高  管  人  员  年  度  绩  效  考  核  汇  总</th></tr><tr>";




                    //第二行表头
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[1].Attributes.Add("rowspan", "2");
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[1].Attributes.Add("bgcolor", "#9aadcd");
                    tcHeader[1].Attributes.Add("color", "#ffffff");
                    tcHeader[1].Text = "序号";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[2].Attributes.Add("rowspan", "2");
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[2].Attributes.Add("bgcolor", "#9aadcd");
                    tcHeader[2].Text = "职务";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[3].Attributes.Add("rowspan", "2");
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[3].Attributes.Add("bgcolor", "#9aadcd");
                    tcHeader[3].Text = "姓名";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[4].Attributes.Add("bgcolor", "#9aadcd");
                    tcHeader[4].Attributes.Add("colspan", "2");
                    tcHeader[4].Text = "公司年度经营业绩指标(50%)";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[5].Attributes.Add("colspan", "2");
                    tcHeader[5].Attributes.Add("bgcolor", "#9aadcd");
                    tcHeader[5].Text = "分管工作指标(30%)";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[6].Attributes.Add("colspan", "2");
                    tcHeader[6].Attributes.Add("bgcolor", "#9aadcd");
                    tcHeader[6].Text = "直接上级月度评价(15%)";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[7].Attributes.Add("colspan", "2");
                    tcHeader[7].Attributes.Add("bgcolor", "#9aadcd");
                    tcHeader[7].Text = "公开测评(5%)";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[8].Attributes.Add("rowspan", "2");
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[8].Attributes.Add("bgcolor", "#9aadcd");
                    tcHeader[8].Text = "合计";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[9].Attributes.Add("rowspan", "2");
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[9].Attributes.Add("bgcolor", "#9aadcd");
                    tcHeader[9].Text = "备注</th></tr><tr>";


                    //第三行表头
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[10].Attributes.Add("bgcolor", "#999999");
                    tcHeader[10].Text = "得分";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[11].Attributes.Add("bgcolor", "#999999");
                    tcHeader[11].Text = "小计";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[12].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[12].Text = "得分";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[13].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[13].Text = "小计";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[14].Attributes.Add("bgcolor", "#999999");
                    tcHeader[14].Text = "得分";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[15].Attributes.Add("bgcolor", "#999999");
                    tcHeader[15].Text = "小计";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[16].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[16].Text = "得分";
                    tcHeader.Add(new TableHeaderCell());
                    //tcHeader[0].Attributes.Add("borderwidth", "1px");
                    tcHeader[17].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[17].Text = "小计";




                    break;
            }
        } 

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 11 Jun 2012, 10:09 AM
Hello,

 Merged headers are supported however I'm afraid that there is no support for merged rows/data cells. 

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Starry
Top achievements
Rank 1
answered on 12 Jun 2012, 12:34 AM
Thanks  a  lot...
    
     How  to  merge   headers???
0
Starry
Top achievements
Rank 1
answered on 12 Jun 2012, 01:18 AM
Thanks  a lot...

 But, I  can't  find  demos like  this  from  here...  http://demos.telerik.com/silverlight/#GridView/Selectors/StyleSelectors/GroupRowStyleSelector 
Tags
GridView
Asked by
Starry
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Starry
Top achievements
Rank 1
Share this question
or