Completed
Last Updated: 08 Oct 2014 15:01 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 0
Category: GridView
Type: Feature Request
0
Resolution: 
Please use the following code snippet to replace RadGridViewDragDropService: 
this.radGridView1.GridViewElement.RegisterService(new CustomDragDropService(this.radGridView1.GridViewElement));  
Completed
Last Updated: 30 Jun 2014 12:28 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 0
Category: GridView
Type: Bug Report
0
To reproduce:
Use the code snippet below:

static DataSet ds;

public form1()
{
    InitializeComponent(); 
    GridviewStyling(radGridView1);
    ds = PrepareDataset();
    BuildGrid();

    //Set_Hierarchy();
    for (int i = 0; i < radGridView1.Templates.Count; i++)
        GridviewTemplateStyling(radGridView1.Templates[i]);

    this.radGridView1.TableElement.PageViewMode = PageViewMode.ExplorerBar;
    this.radGridView1.ViewCellFormatting += radGridView1_ViewCellFormatting;
}

       void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    GridDetailViewCellElement detailCell = e.CellElement as GridDetailViewCellElement;
    if (detailCell != null)
    {
        GridViewHierarchyRowInfo hierarchyRow = (GridViewHierarchyRowInfo)((GridViewDetailsRowInfo)detailCell.RowInfo).Owner;
        detailCell.PageViewElement.Header.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
        RadPageViewElement el = detailCell.PageViewElement as RadPageViewExplorerBarElement;
        if (el != null)
        {
            for (int i = 0; i < el.Items.Count; i++) // detailCell.PageViewElement.Items.Count
            {
                RadPageViewItem item = detailCell.PageViewElement.Items[i];
                GridViewInfo viewInfo = hierarchyRow.Views[i];
                item.MaxSize = new Size(0, 1);
                item.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
                if (viewInfo.ChildRows.Count != 0)
                {
                    item.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
                }
            }
        }
    }
}

private DataSet PrepareDataset()
{
    Random r = new Random();
    DataSet ds = new DataSet("DS");

    //snir
    DataTable dtFirst = new DataTable("Snir");
    dtFirst.Columns.Add("pId", typeof(int));
    dtFirst.Columns.Add("Col1", typeof(int));
    dtFirst.Columns.Add("Col", typeof(string));
    dtFirst.Columns.Add("Col3", typeof(int));
    dtFirst.Columns.Add("Col4", typeof(string));
    for (int i = 0; i < 5; i++)
        dtFirst.Rows.Add(1, i, "snirsnirsnir" + r.Next(0, 100).ToString(),
            r.Next(0, 35), "snir" + r.Next(0, 100).ToString());

    // jenny
    DataTable dtSecond = new DataTable("Jenny");
    dtSecond.Columns.Add("pId", typeof(int));
    dtSecond.Columns.Add("Col1", typeof(int));
    dtSecond.Columns.Add("Col2", typeof(string));
    dtSecond.Columns.Add("Col3", typeof(int));
    dtSecond.Columns.Add("Col4", typeof(string));
    dtSecond.Columns.Add("Col5", typeof(string));
    dtSecond.Columns.Add("Col6", typeof(string));
    for (int i = 0; i < 5; i++)
        dtSecond.Rows.Add(2, i, "CnC" + r.Next(0, 100).ToString(),
            r.Next(0, 35), "jenny" + r.Next(0, 100).ToString(), "col5", "col6");

    //index
    DataTable table1 = new DataTable("Index");
    table1.Columns.Add("TableId", typeof(int));
    table1.Columns.Add("TableName", typeof(string));
    table1.Columns.Add("UpdateType", typeof(int));
    table1.Rows.Add(1, dtFirst.TableName, r.Next(0, 3));
    table1.Rows.Add(2, dtSecond.TableName, r.Next(0, 3));

    ds.Tables.AddRange(new DataTable[] { table1, dtFirst, dtSecond });

    return ds;
}

private void BuildGrid()
{
    // bind the master template
    this.radGridView1.DataSource = ds;
    this.radGridView1.DataMember = "Index";

    //templates
    GridViewTemplate template1 = new GridViewTemplate();
    template1.DataSource = ds.Tables[1];
    template1.Columns[0].IsVisible = false;
    template1.EnableHierarchyFiltering = false;
    template1.ShowGroupedColumns = false;

    radGridView1.Templates.Add(template1);

    GridViewTemplate template2 = new GridViewTemplate();
    template2.DataSource = ds.Tables[2]; // 1:snir   // 2:jenny
    radGridView1.Templates.Add(template2);
    template1.AllowDragToGroup = false;

    //relations
    GridViewRelation relation1 = new GridViewRelation(radGridView1.MasterTemplate);//, template2);
    relation1.RelationName = "myRelation1";
    relation1.ChildTemplate = radGridView1.Templates[0];
    relation1.ChildColumnNames.AddRange(new string[] { "pId" });
    relation1.ParentColumnNames.Add("TableId");
    radGridView1.Relations.Add(relation1);

    GridViewRelation relation2 = new GridViewRelation(radGridView1.MasterTemplate);//, template2);
    relation2.RelationName = "myRelation2";
    relation2.ChildTemplate = radGridView1.Templates[1];
    relation2.ChildColumnNames.AddRange(new string[] { "pId" });
    relation2.ParentColumnNames.Add("TableId");
    radGridView1.Relations.Add(relation2);
}

private void GridviewStyling(RadGridView rgv)
{
    //radGridView1 styling
    rgv.AllowAddNewRow = false;
    rgv.EnableGrouping = false;
    rgv.AllowDragToGroup = false;

    rgv.AllowDrop = false;
    rgv.AllowEditRow = false;
    rgv.AllowDrop = false;
    rgv.AllowRowResize = false;

    rgv.AllowColumnResize = false;
    rgv.AutoExpandGroups = true;
    rgv.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
    rgv.EnableCustomGrouping = false;

    rgv.ShowColumnHeaders = true;
    rgv.ShowRowHeaderColumn = false;
    rgv.ShowGroupPanel = false;
}

private void GridviewTemplateStyling(GridViewTemplate gvt)
{
    //template styling
    gvt.AllowAddNewRow = false;
    gvt.Columns[0].IsVisible = false;
    gvt.ShowChildViewCaptions = false;

    gvt.AllowDragToGroup = false;
    gvt.AllowRowResize = false;
    gvt.AllowColumnResize = false;
    gvt.AutoExpandGroups = true;

    gvt.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
    gvt.ShowRowHeaderColumn = false;
    gvt.ShowColumnHeaders = true;
}

private string GetEnumString(int n)
{
    switch (n)
    {
        case (int)TableUpdateModeEnum.INSERT:
            return "INSERT";
        case (int)TableUpdateModeEnum.UPDATE:
            return "UPDATE";
        case (int)TableUpdateModeEnum.UPDATE_OR_INSERT:
            return "UPDATE/DELETE";
        case (int)TableUpdateModeEnum.DELETE_OR_INSERT:
            return "INSERT/DELETE";
        default:
            return "";
    }
}

public enum TableUpdateModeEnum
{
    [Description("Snir")]
    INSERT = 0,
    [Description("Liraz")]
    UPDATE_OR_INSERT = 1,
    [Description("Jenny")]
    UPDATE = 2,
    [Description("Tsuria")]
    DELETE_OR_INSERT = 3
};        

Scenario:
1.Expand a master row.
2.Start dragging columns from the child template.
3.When your are dragging over the thick border , the exception occur.
Completed
Last Updated: 03 Aug 2014 21:45 by KennethMoss
To reproduce:
- Add the following column to a blank grid and new row or edit the existing one:
GridViewMaskBoxColumn maskBoxColumn = new GridViewMaskBoxColumn();
maskBoxColumn.Name = "Dates";
maskBoxColumn.HeaderText = "Dates";
maskBoxColumn.MaskType = MaskType.FreeFormDateTime;
maskBoxColumn.DataType = typeof(System.DateTime);
radGridView1.MasterTemplate.Columns.Add(maskBoxColumn);
this.radGridView1.Rows.Add(DateTime.Now.AddDays(5));


Completed
Last Updated: 10 Jul 2014 13:14 by ADMIN
To reproduce:

Add a RadGridView with some data and enable the paging functionality. Also set the AutoSize property to true:

grid.EnablePaging = true;
grid.AutoSize = true;

Start the application and you will see that when you try to edit the textbox with the number of the page you will not be able to.

Workaround:

Set the AutoSize property to false and use MinimumSize instead:

grid.AutoSize = false;
grid.MinimumSize = new Size(600, 500);

Unplanned
Last Updated: 15 Aug 2017 09:45 by ADMIN
ADMIN
Created by: Dimitar
Comments: 0
Category: GridView
Type: Feature Request
0
 RadGridView, TextBoxColumn - add support for autocomplete.
Completed
Last Updated: 01 Oct 2014 12:59 by ADMIN
To reproduce:

public Form1()
{
    InitializeComponent();
    radGridView1.ToolTipTextNeeded += radGridView1_ToolTipTextNeeded;
}

private void radGridView1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
{
    GridDataCellElement cell = sender as GridDataCellElement;
    if (cell != null)
    {
        e.ToolTipText = cell.Value.ToString();
        toolTipText = e.ToolTipText;
        e.ToolTip.OwnerDraw = true;
        e.ToolTip.Draw += ToolTip_Draw;
        e.ToolTip.Popup += ToolTip_Popup;
    }
}

private void ToolTip_Popup(object sender, PopupEventArgs e)
{
    e.ToolTipSize = TextRenderer.MeasureText(toolTipText + "   ", newFont);
}

Font newFont = new Font("Arial", 15f, FontStyle.Bold);
string toolTipText = string.Empty;

private void ToolTip_Draw(object sender, DrawToolTipEventArgs e)
{
    e.Graphics.FillRectangle(SystemBrushes.Control, e.Bounds);
    e.DrawBorder();         
    using (StringFormat sf = new StringFormat())
    {
        sf.Alignment = StringAlignment.Center;
        sf.LineAlignment = StringAlignment.Far;
        sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None;
        sf.FormatFlags = StringFormatFlags.NoClip;

        e.Graphics.DrawString(e.ToolTipText, newFont, Brushes.Red, e.Bounds, sf);
    }
}

Completed
Last Updated: 21 Oct 2015 12:25 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 0
Category: GridView
Type: Bug Report
0
Note: it is reproducible when using ColumnGroupsViewDefinition too.

Workaround: unpin all pinned columns before printing and restore their state after printing:
Completed
Last Updated: 29 Jul 2014 12:32 by ADMIN
To reproduce:

Private _createDataTable As Object
Private _BoxValue As String

Sub New()

    InitializeComponent()

    RelCalculateValues()
    Me.RadGridView1.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.AllCells)
End Sub

Private Sub RadGridView1_CellEndEdit(sender As Object, e As GridViewCellEventArgs) _
    Handles RadGridView1.CellEndEdit
    If e.RowIndex < 0 OrElse e.ColumnIndex < 0 Then Exit Sub
    If e.Value = _BoxValue Then Exit Sub
    If e.Column.Name <> "AllowedWane" Then Exit Sub
    Dim fTester As Decimal
    Dim rRow As Telerik.WinControls.UI.GridViewDataRowInfo = e.Row
    Dim iRowID As Int32
    iRowID = rRow.Cells("ID").Value
    If iRowID < 0 Then Exit Sub

    Select Case e.Column.Name
        Case "AllowedWane"
            If Decimal.TryParse(e.Value, fTester) = False Then
                rRow.Cells(e.Column.Name).Value = _BoxValue
                Exit Sub
            Else
                Select Case e.Column.OwnerTemplate.MasterTemplate.Owner.Name
                    Case RadGridView1.Name
                        RelCalculateValues(Me.RadGridView1)

                End Select
            End If
    End Select
End Sub

Private Sub RelCalculateValues(ByVal rgvAsete As Telerik.WinControls.UI.RadGridView)
    Dim dtJakauma As New DataTable
    Dim drJakauma As DataRow
    dtJakauma.Columns.Add("ID", GetType(Int32))
    dtJakauma.Columns.Add("Dimensions", GetType(String))
    dtJakauma.Columns.Add("Pcs", GetType(String))
    dtJakauma.Columns.Add("Percents", GetType(String))
    dtJakauma.Columns.Add("Price", GetType(String))
    dtJakauma.Columns.Add("UsageFactor", GetType(String))
    dtJakauma.Columns.Add("CubicMeters", GetType(String))
    dtJakauma.Columns.Add("EdgeLimit", GetType(String))
    dtJakauma.Columns.Add("AllowedWane", GetType(String))
    dtJakauma.Columns.Add("Length", GetType(String))

    For i As Int32 = 0 To 5
        drJakauma = dtJakauma.NewRow
        drJakauma("ID") = 0
        drJakauma("Dimensions") = "Dimensions_" & i
        drJakauma("Pcs") = "Pcs_" & i
        drJakauma("Percents") = "Percents_" & i
        drJakauma("Price") = "Price_" & i
        drJakauma("UsageFactor") = "UsageFactor_" & i
        drJakauma("CubicMeters") = "CubicMeters_" & i
        drJakauma("EdgeLimit") = "EdgeLimit_" & i
        drJakauma("AllowedWane") = "AllowedWane_" & i
        drJakauma("Length") = "Length_" & i
        dtJakauma.Rows.Add(drJakauma)
    Next
    rgvAsete.DataSource = dtJakauma
    rgvAsete.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.AllCells)
End Sub


Workaround: set the RadGridView.DataSource to null/Nothing before setting it to the new DataTable.
Completed
Last Updated: 07 Jul 2014 10:41 by ADMIN
To reproduce:

Create a self reference RadGridView and add enough columns so that a horizontal scrollbar appears. Scroll the horizontal scrollbar to the right and close the form. You will see an exception.

Workaround:

Create a custom row element in the CreateRow event:

void radGridView1_CreateRow(object sender, Telerik.WinControls.UI.GridViewCreateRowEventArgs e)
{
    if (e.RowInfo is GridViewHierarchyRowInfo || e.RowInfo is GridViewDataRowInfo)
    {
        e.RowElement = new MyDataRowElement();
    }
}

public class MyLayout : SelfReferenceCellLayout
{
    public MyLayout(GridRowElement rowElement) : base(rowElement) { }

    public override void DetachCellElements()
    {
        if (this.StackLayoutElement != null)
        {
            base.DetachCellElements();
        }
    }
}

public class MyDataRowElement : GridDataRowElement
{
    private MyLayout cellReferenceLayout;

    public override void Detach()
    {
        base.Detach();

        if (this.cellReferenceLayout != null)
        {
            this.cellReferenceLayout.DetachCellElements();
        }
    }

    protected override void DisposeManagedResources()
    {
        if (this.cellReferenceLayout != null)
        {
            this.cellReferenceLayout.Dispose();
        }

        base.DisposeManagedResources();
    }

    public override SelfReferenceCellLayout SelfReferenceLayout
    {
        get
        {
            if (this.RowInfo is GridViewHierarchyRowInfo)
            {
                if (this.ViewTemplate != null &&
                    this.ViewTemplate.IsSelfReference &&
                    this.cellReferenceLayout == null)
                {
                    this.cellReferenceLayout = new MyLayout(this);
                }

                return this.cellReferenceLayout;
            }

            return null;
        }
    }

    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(GridDataRowElement);
        }
    }
}
Completed
Last Updated: 12 Jun 2014 19:35 by ADMIN
To reproduce:

public Form1()
{
    InitializeComponent();
    
    radGridView1.Columns.Add("Id");
    radGridView1.Columns.Add("ParentID");
    radGridView1.Columns.Add("Name");

    radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, "Id", "ParentID");

    for (int id = 1; id <= 3; id++)
    {
        radGridView1.MasterTemplate.Rows.Add(id, 0, "Node_" + id);
        for (int iChild = 1; iChild <= 5; iChild++)
        {
            int childId = id * 100 + iChild;
            radGridView1.MasterTemplate.Rows.Add(childId, id, "ChildNode_" + childId);
        }
    }
    foreach (GridViewHierarchyRowInfo row in this.radGridView1.Rows)
    {
       row.IsExpanded = true;
    }
}
Completed
Last Updated: 11 Dec 2015 14:55 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 4
Category: GridView
Type: Feature Request
1

			
Completed
Last Updated: 30 May 2014 08:39 by ADMIN
Workaround: the MasterTemplate has Copy method, which allows overriding in its descendants. Thus, it is possible to modify the copied data according to the specific requirements:

public class CustomGrid : RadGridView
{
    protected override RadGridViewElement CreateGridViewElement()
    {
        return new CustomRadGridViewElement();
    }

    public override string ThemeClassName 
    {
        get
        {
            return typeof(RadGridView).FullName; 
        }
    }
}

public class CustomRadGridViewElement : RadGridViewElement
{
    protected override MasterGridViewTemplate CreateTemplate()
    {
        return new CustomMasterGridViewTemplate();
    }
    
    protected override Type ThemeEffectiveType    
    {
        get   
        {
            return typeof(RadGridViewElement);    
        }
    }
}

public class CustomMasterGridViewTemplate : MasterGridViewTemplate
{
    public override void Copy()
    {
        base.Copy();
 
        if (Clipboard.ContainsData(DataFormats.Text))
        {
            string data = Clipboard.GetData(DataFormats.Text).ToString();
     
            if (data != string.Empty)
            {
                StringBuilder sb = new StringBuilder(data);
                //modify the copied data and replace it in the clipboard
                Clipboard.SetData(DataFormats.Text, sb.ToString());
            }
        }
    }
}
Completed
Last Updated: 21 May 2014 14:47 by ADMIN
To reproduce:
- Add grid with enabled paging and filtering to a blank form.
- Select the second page and apply a filter.
Completed
Last Updated: 22 May 2014 11:40 by ADMIN
To reproduce: add a RadGridView and bind it to the Northwind.Products data table. Use the following code:

private void Form1_Load(object sender, EventArgs e)
{
    this.productsTableAdapter.Fill(this.nwindDataSet.Products);

    RadMessageBox.Show(string.Format("TOTAL2 = {0}", NewExpression()));
}

public string NewExpression()
{
    this.radGridView1.Columns.Add(new GridViewDecimalColumn("TOTAL1") { Expression = "ReorderLevel + UnitsOnOrder" });
    this.radGridView1.Columns.Add(new GridViewDecimalColumn("TOTAL2") { Expression = "TOTAL1 + UnitPrice" });
    
    //uncomment to get the value of "TOTAL2"
    // var total1 = this.radGridView1.Rows[2].Cells["TOTAL1"].Value;

    var total2 = this.radGridView1.Rows[2].Cells["TOTAL2"].Value;

    return total2.ToString();
}

It  is not possible to access the column value ("TOTAL2") before firstly to access the column "TOTAL1" value.
Completed
Last Updated: 13 Jun 2014 12:41 by ADMIN
To reproduce:
- Filer twice by a single column with Excel-like filtering.
- The second time InvalidCastException will occur.

Workaround:
- Create custom columns and override the GetDistinctValues method.

public class MyColumn : GridViewTextBoxColumn
{
    protected override GridViewColumnValuesCollection GetDistinctValues()
    {
        int index = this.Index;

        if (index >= 0)
        {
            GridViewColumnValuesCollection distinctValues = new GridViewColumnValuesCollection();
            foreach (GridViewRowInfo row in this.OwnerTemplate.Rows)
            {
               
                object cellValue = row.Cells[index].Value;
                if (!distinctValues.Contains(cellValue))
                {
                    distinctValues.Add(cellValue);
                }
            }
            if (distinctValues.Count > 0)
            {
                return distinctValues;
            }
        }

        return null;
    }
}

Declined
Last Updated: 21 Oct 2015 08:38 by ADMIN
To reproduce:
- Add grid with a DateTime column with default value "5/1/2014";
- Start the app and press the following keys one after another: 5/1/
- You will notice that the "1" is not replaced.

Please note that the similar behavior occur when the year is entered (it does not match the default one). 

Workaround handle the key press for such cases manually:

void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadDateTimeEditor ed = e.ActiveEditor as RadDateTimeEditor;
    
    RadDateTimeEditorElement el = ed.EditorElement as RadDateTimeEditorElement;
    el.KeyPress += el_KeyPress;
}

private void el_KeyPress(object sender, KeyPressEventArgs e)
{
	RadDateTimeEditorElement el = (RadDateTimeEditorElement)sender;
	int day = el.Value.Value.Day;
	int key = -1;
	int.TryParse(e.KeyChar.ToString(), key);

	RadMaskedEditBoxElement element = el.TextBoxElement.TextBoxItem.Parent as RadMaskedEditBoxElement;
	MaskDateTimeProvider provider = element.Provider as MaskDateTimeProvider;

	if (provider.SelectedItemIndex == 2) {
		if (key > 0 & key <= 9) {
			if (el.TextBoxElement.TextBoxItem.SelectionLength != 0) {
				if (!booKeying) {
					dynamic NewValue = new DateTime(el.Value.Value.Year, el.Value.Value.Month, key);
					el.Value = NewValue;
					e.Handled = true;
					booKeying = true;
				}
			}
		}
	}
}
Declined
Last Updated: 06 Feb 2018 06:40 by ADMIN
To reproduce:
- Add a RadGridView and a button to a blank form.
- Subscribe to CellValidating event from the grid and set the cancel property of the CellValidatingEventArgs to true upon some condition.
- Add click event handler for the button and print a message in it.
- Start the application and enter some invalid data in the grid cell, then click the button.
- The code from the button's event handler is executed.

Workaround use a flag to determine when to execute the corresponding button code:
bool validating = false;

void radGridView1_CellValidating(object sender, Telerik.WinControls.UI.CellValidatingEventArgs e)
{
    if (e.Value.ToString().Length < 5)
    {
        e.Cancel = true;
        validating = true;
        e.Row.ErrorText = "Validation error!";
    }
    else
    {
        validating = false;
    }
}

private void radButton1_Click(object sender, EventArgs e)
{
    if (!validating)
    {
        Debug.WriteLine("Executed");
    }
}


Completed
Last Updated: 13 Jun 2014 12:17 by ADMIN
To reproduce:
- Add a grid with some columns to a blank form (the rows should not fill the entire space).
- Press and hold the left mouse button, the move the mouse to the empty area of the grid.
- Continue to move the mouse and you will notice the event is fired several times.

Workaround:
- use the CurrentCellChanged event.
Completed
Last Updated: 01 Oct 2014 12:58 by ADMIN
Workaround: 
void radGridView1_PrintCellFormatting(object sender, PrintCellFormattingEventArgs e)
{
    if (e.Column is GridViewImageColumn && e.Row is GridViewDataRowInfo)
    {
        e.PrintCell.DrawFill = true;
 
        if (radGridView1.PrintStyle.PrintAlternatingRowColor && e.Row.Index % 2 == 1)
        {
            e.PrintCell.BackColor = radGridView1.PrintStyle.AlternatingRowColor;
        }
        else
        {
            e.PrintCell.BackColor = radGridView1.PrintStyle.CellBackColor;
        }
    }
}