06
2015
01

Radgrid实现行合并

 

 


  public static void MergeRows(RadGrid RadGrid1)
        {
            for (int i = RadGrid1.Items.Count - 2; i > 0; i--)
            {
                if (RadGrid1.Items[i][RadGrid1.Columns[0]].Text == RadGrid1.Items[i - 1][RadGrid1.Columns[0]].Text)
                {
                    RadGrid1.Items[i - 1][RadGrid1.Columns[0]].RowSpan = RadGrid1.Items[i][RadGrid1.Columns[0]].RowSpan < 2 ? 2 : RadGrid1.Items[i][RadGrid1.Columns[0]].RowSpan + 1;                    
                    RadGrid1.Items[i][RadGrid1.Columns[0]].Visible = false;
                    //RadGrid1.Items[i][RadGrid1.Columns[0]].Text = "&nbsp;"; 
                }
            }
            //To mau lai cho Radgird
            foreach (GridDataItem dataItem in RadGrid1.Items)
            {
                foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns)
                {
                    //if (dataItem[col.UniqueName].Text == string.Empty)
                    dataItem[col.UniqueName].Style.Add("border-left", "solid 1px #ededed");
                }
            }   
        }

« 上一篇下一篇 »

相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。