Approved
Last Updated: 05 Apr 2017 14:22 by ADMIN
ADMIN
Dimitar
Created on: 07 Mar 2017 12:31
Category: GridView
Type: Bug Report
1
FIX. RadGridView manually setting the PinPosition of a summary row is not serialized by the SaveLayout method.
To reproduce:
public RadForm1()
{
    InitializeComponent();
    radGridView1.DataSource = GetTable();
    GridViewSummaryItem summaryItem = new GridViewSummaryItem();
    summaryItem.Name = "Name";
    summaryItem.Aggregate = GridAggregateFunction.Count;
    GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem();
    summaryRowItem.Add(summaryItem);
    this.radGridView1.SummaryRowsBottom.Add(summaryRowItem);

    radGridView1.ViewCellFormatting += RadGridView1_ViewCellFormatting;
}

private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement is GridSummaryCellElement)
    {
        e.CellElement.DrawFill = true;
        e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
        e.CellElement.BackColor = Color.Red;

    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local);
    }
}

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    radGridView1.MasterView.SummaryRows[0].PinPosition = PinnedRowPosition.Bottom;
}

static DataTable GetTable()
{

    DataTable table = new DataTable();
    table.Columns.Add("Dosage", typeof(int));
    table.Columns.Add("Drug", typeof(string));
    table.Columns.Add("Name", typeof(string));
    table.Columns.Add("Date", typeof(DateTime));

    for (int i = 0; i < 5; i++)
    {


        table.Rows.Add(25, "Indocin", "David", DateTime.Now);
        table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now);
        table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now);
        table.Rows.Add(21, "Combivent", "Janet", DateTime.Now);
        table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now);
    }
    return table;
}
private void radButton1_Click(object sender, EventArgs e)
{

    radGridView1.SaveLayout("test.xml");
}

private void radButton2_Click(object sender, EventArgs e)
{
    radGridView1.SummaryRowsBottom.Clear();
    radGridView1.SummaryRowsTop.Clear();
    radGridView1.LoadLayout("test.xml");
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments