Hi.
I'm facing and issue with displaying hierarchical data (self-referencing) in grid when missing parent items in data source - only part of data is displayed.
1. Add grid to form
1.var grid = new RadGridView {Dock = DockStyle.Fill};2.this.Controls.Add(grid);3.grid.Columns.Add("cName","Name","Name"); //Dummy column displaying Name
2. Setup self-referencing
1.var col1 = new GridViewTextBoxColumn("hiddenColumnId", "Id");2.var col2 = new GridViewTextBoxColumn("hiddenColumnParentId", "ParentId");3.grid.MasterTemplate.Columns.Add(col1);4.grid.MasterTemplate.Columns.Add(col2);5.grid.Columns["hiddenColumnId"].IsVisible = false;6.grid.Columns["hiddenColumnParentId"].IsVisible = false;7.grid.Relations.AddSelfReference(grid.MasterTemplate, "hiddenColumnId", "hiddenColumnParentId");
3. Create dummy data type
01.class Item02.{03. public Item(int id, string name, int? parentId = null)04. {05. Id = id;06. Name = name;07. ParentId = parentId;08. }09. 10. public int Id { get; set; }11. public string Name { get; set; }12. public int? ParentId { get; set; }13.}
4. Add new data source
01.var items = new List<Item>02.{03. new Item(1,"1"),04. new Item(2,"1.1",1),05. new Item(3,"1.2",1),06. new Item(7,"1.2.1",3),07. new Item(4,"2"),08. new Item(5,"2.1",4),09. new Item(6,"2.2",4)10.};11.grid.DataSource = items;
And as expected a correct tree structure is displayed
1.12.-1.13.-1.24.--1.2.15.26.-2.17.-2.2
However in my case due to busines logic I have only a subset of data - all except item "1" and "2".
Instead of ex
1.1.12.1.23.-1.2.14.2.15.2.2
I can see only children of first missing parent item. Although the number of rows is matching correct total number of item to be displayed (5) only part of items are visible (3).
1.1.12.1.23.-1.2.1
As a workaroud I can modify data source and remove parent assignement from objects if parent is missing in data source either on data preparation or DataBindingComplete event.
01.private void Grid_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)02. {03. var grid = sender as RadGridView;04. 05. // Get existing items06. var ids = new List<object>();07. foreach (var id in grid.Columns["hiddenColumnId"].DistinctValues)08. {09. ids.Add(id);10. }11. 12. // Remove missing parents13. foreach (var row in grid.Rows)14. {15. var parentId = row.Cells["hiddenColumnParentId"].Value;16. if (!ids.Contains(parentId))17. row.Cells["hiddenColumnParentId"].Value = null;18. }19.}
However this solution is not suitable, because it is modifying data providing inconsistant state - using that data in code I may falsly assume that the item does not have a parent while it has.
Any ideas how to solve this issue?
Regargs
Greg

Hello,
In the chart legend, I would like to show a line next to an item instead of a square. For the ChartView for Winforms I have been unable to find any information on the ability to change the shape. Is that possible?
As I work around, I had an idea to set the top and bottom border as white and increase the border size thinking that I could make the square look like a line I tried that with the following code, but it seems to have no affect. The default black border is sown instead.
LegendItem item = new LegendItem();
item.Element.BackColor = Color.Blue;
item.Element.BorderBottomColor = Color.White;
item.Element.BorderTopColor = Color.White;
item.Element.BorderTopWidth = 3;
item.Element.BorderBottomWidth = 3;
this.mainChart.ChartElement.LegendElement.Items.Add(item);
I am able to change the entire border using the following code. It displays a smaller square, which is kind of acceptable but there seems to be a shadow still visible.
LegendItem item = new LegendItem();
item.Element.BackColor = Color.Blue;
item.Element.BorderColor = Color.White;
item.Element.BorderWidth = 3;
this.mainChart.ChartElement.LegendElement.Items.Add(item);
Any ideas on how to achieve my goal?
Chris
Hi,
I'm working with the RadGridView component directly without use a model binding.
I would like to add dynamically a new Row at a position in my grid view after an other row by using :
gridView.Rows.Insert(row.Index + 1, newRow);It's working well if I'm not using a grouping. But when I add the grouping :
GroupDescriptor descriptor = new GroupDescriptor();descriptor.GroupNames.Add("NomGroupe", ListSortDirection.Ascending);gridView.GroupDescriptors.Add(descriptor);It's not work because the Index is ordered by the groupe.
How How can I do?
Thanks for your help,
Simon

Hi everybody, I'm evaluating RadBarcode for printing barcodes in thermal printers. My printers have a resolution of 203 dpi in both horizontal and vertical directions. I'm trying to generate an image of the barcode (EAN13) and sending to printer:
public DrawBarcode(Point Location, Size Size, string valor): base(Location)
{
this.Valor = valor;
bc = new RadBarcode();
bc.Value = valor;
var EAN13 = new Telerik.WinControls.UI.Barcode.Symbology.EAN13();
EAN13.ShowText = true;
bc.Symbology = EAN13;
EAN13.Stretch = true;
int n = 50;
while (true)
{
try
{
img = bc.ExportToImage(2*n, n);
this.size = img.Size;
return;
}
catch (Exception) { n += 10; }
}
}
public override void Draw(Graphics g)
{
base.Draw(g);
g.DrawImage(img, 0, 0);
}
I have a base class for controling Drag, zoom and rotation but it is not important in this scenario. When I send the image to screen, text is rendered perfectly but when I send the image to the printer, text is not redeable. Is it any why to specify resolution in ExortToImage or any other why to change generated image resolution?

I'm trying to use the built-in Excel function COUNTIF on a cell range. How do you return the integer result of that value? Do I have to specifically set the formula to a cell first and get the result that way? Or can I somehow just get the result without actually having to write the formula to a cell?
Thank you in advance.

Good day,
I want to get the zoom back to the original zoom and position after the radDiagram being zoomed.
Sometimes it is difficult to keep the zoom in good position. Thus I would like to put it again in the default zoom and point when pushing a button.
The RadDiagram making code, creating the RadDiagram:
Telerik.Windows.Diagrams.Core.DiagramConstants.MinimumZoom = 0.1 Telerik.Windows.Diagrams.Core.DiagramConstants.MaximumZoom = 10 MyRadDiagram.Zoom = 0.1 MyRadDiagram.IsSettingsPaneEnabled = False MyRadDiagram.DiagramElement.IsBackgroundSurfaceVisible = False MyRadDiagram.BackgroundGrid.Visibility = False MyRadDiagram.BackgroundPageGrid.Visibility = Telerik.WinControls.ElementVisibility.Hidden MyRadDiagram.BackgroundImageLayout = ImageLayout.None MyRadDiagram.BackgroundImage = Nothing posCentral = MyRadDiagram.PositionThe code I use to get back to original zoom:
Private posCenter As New Telerik.Windows.Diagrams.Core.Point(0, 0)Private Sub bCenterZoom_Click(sender As Object, e As EventArgs) Handles bCenterZoom.Click loading = True MyRadDiagram.Position = posCentral MyRadDiagram.Zoom = 0.1 loading = FalseEnd Sub

Greetings,
Is it possible to edit UI elements of of controls programmatically ?
For instance, I want to change header font of a Radgroupbox.
I normally should open its smartTag and change the font within root elements. But how to do it programmatically ?

