Telerik Forums
UI for WinForms Forum
3 answers
155 views

Hello everyone!

I use Telerik controls in my project and have faced with the problem:

I need present my data in RadGridView control in hierarchical view.

The parents' rows should have own set of columns. (For example, the top rows' structure is "Id" and "Name").

For each parent row, their children should have own set of columns that different from theirs parents' rows and different from each other.

For example:

child rows that belong to parent1, should have structure - "Id", "ParentId", "Name", "Price", "Count".

child rows that belong to parent2, should have structure - "Id", "ParentId", "Name", "Date".

In addition, children's should present as a tree, and leafs of this tree should reference on itself.

I think relations between parents and children should be made by GridViewRelation type.

Relations between child rows also should be made by GridViewRelation type.

I have prepared simple example (method Init should call insinde form's contructor that has RadGridView (named as grid) on it), that shows this problem:

 

        /// <summary>

 

        /// Initialize data

        /// </summary>

        private void Init()

        {

             grid.BeginUpdate();

             // Create parents' data:

             // 1. Define structure

             var parentData = new DataTable();

             parentData.Columns.Add("Id");           

             parentData.Columns.Add("Name");

             // 2. Add data

             parentData.Rows.Add(1, "Product1");

             parentData.Rows.Add(2, "Product2");

             parentData.Rows.Add(3, "Product3");

             // 3. Assign data source to grid

             grid.DataSource = parentData;

 

             #region Create the first child's data

            // 1. Define structure

             var childData1 = new DataTable();

             childData1.Columns.Add("Id");

             childData1.Columns.Add("ParentId");

             childData1.Columns.Add("Name");

             childData1.Columns.Add("Price");

             childData1.Columns.Add("Count");

 

             // 2. Add data

             childData1.Rows.Add(10, 1, "Product11", 10.99, 10);

                 childData1.Rows.Add(100, 10, "Product111", 12, 112);

                 childData1.Rows.Add(101, 10, "Product112", 2, 105);

                     childData1.Rows.Add(1000, 101, "Product1121", 5, 0);

            // 3. Create GridViewTemplate instance

             var template1 = new GridViewTemplate();

             grid.Templates.Add(template1);

             template1.DataSource = childData1;

             template1.BestFitColumns();

 

             // 4. Create relation for parent template

             var relation1 = new GridViewRelation(grid.MasterTemplate, template1);

             relation1.ChildColumnNames.Add("ParentId");

             relation1.ParentColumnNames.Add("Id");

             grid.Relations.Add(relation1);

             // 5. Create relation for self

             var selfRelation1 = new GridViewRelation(template1, template1);

             selfRelation1.ChildColumnNames.Add("ParentId");

             selfRelation1.ParentColumnNames.Add("Id");

             grid.Relations.Add(selfRelation1);

 

             #endregion Create the first child's data

 

             #region Create the second child's data

 

             // 1. Define structure

             var childData2 = new DataTable();

             childData2.Columns.Add("Id");

             childData2.Columns.Add("ParentId");

             childData2.Columns.Add("Name");

             childData2.Columns.Add("GUID");

 

             // 2. Add data

             childData2.Rows.Add(11, 2, "Product21", Guid.NewGuid().ToString());

                 childData2.Rows.Add(110, 11, "Product211", Guid.NewGuid().ToString());

                     childData2.Rows.Add(1100, 110, "Product2111", Guid.NewGuid().ToString());

                         childData2.Rows.Add(11000, 1100, "Product21111", Guid.NewGuid().ToString());

 

             // 3. Create GridViewTemplate instance

             var template2 = new GridViewTemplate();

             grid.Templates.Add(template2);

             template2.DataSource = childData2;

             template2.BestFitColumns();

            // 4. Create relation for parent template

             var relation2 = new GridViewRelation(grid.MasterTemplate, template2);

             relation2.ChildColumnNames.Add("ParentId");

             relation2.ParentColumnNames.Add("Id");

             grid.Relations.Add(relation2);

 

             // 5. Create relation for self

             var selfRelation2 = new GridViewRelation(template2, template2);

             selfRelation2.ChildColumnNames.Add("ParentId");

             selfRelation2.ParentColumnNames.Add("Id");

             grid.Relations.Add(selfRelation2);

            #endregion Create the second child's data

            #region Create the third child's data

 

             // 1. Define structure

             var childData3 = new DataTable();           

             childData3.Columns.Add("Id");

             childData3.Columns.Add("ParentId");

             childData3.Columns.Add("Name");

             childData3.Columns.Add("Date");

             childData3.Columns.Add("Flag");

 

             // 2. Add data

             childData3.Rows.Add(12, 3, "Product13", DateTime.Now, true);

                 childData3.Rows.Add(120, 12, "Product131", DateTime.Now, false);

                     childData3.Rows.Add(1200, 120, "Product131", DateTime.Now, false);

                     childData3.Rows.Add(1201, 120, "Product132", DateTime.Now, true);

 

             // 3. Create GridViewTemplate instance

             var template3 = new GridViewTemplate();

             grid.Templates.Add(template3);

             template3.DataSource = childData3;

             template3.BestFitColumns();

 

             // 4. Create relation for parent template

             var relation3 = new GridViewRelation(grid.MasterTemplate, template3);

             relation3.ChildColumnNames.Add("ParentId");

             relation3.ParentColumnNames.Add("Id");

             grid.Relations.Add(relation3);

 

             // 5. Create relation for self

             var selfRelation3 = new GridViewRelation(template3, template3);

             selfRelation3.ChildColumnNames.Add("ParentId");

             selfRelation3.ParentColumnNames.Add("Id");

             grid.Relations.Add(selfRelation3);

                

             #endregion Create the third child's data

            grid.BestFitColumns();

 

             grid.EndUpdate();

         }

 

I have attached file "Example.jpeg" that illustrates the view that i want.
Can RadGridView present data as I need?!

The result that I get after Init() calling is incorrect.

There are some tabs in children grids named as "table"...

Can you give me advice what i do wrong? What can i do to achieve the desired result?
I hope you understand my problem.

Thanks a lot!

P.S.: Telerik's version is 2011.3.11.1116

Denis
Top achievements
Rank 1
 answered on 24 Aug 2012
1 answer
441 views
Hello,

Good Day.
I have set the themes of out application to  "Office2010Blue"
       Dim theme As New Office2010BlueTheme()
       ThemeResolutionService.ApplicationThemeName = "Office2010Blue"
All the Controls Theme became "Office2010Blue"
This is OK for me.

My Question is: I have a RadPageView. Is it possible to set its theme to the Default theme "ControlDefault". I like the the color of the Default theme for the PageView.

I have read that the ApplicationThemeName is greater than ThemeName in controls.
Can we override then ApplicationThemeName for specific controls?

Is there a workaround for this? or
Should i set the individual theme for all controls by ThemeName so that i can have multiple themes
I dont want to edit the themes using StyleBuilder.
I just want to know if their is an easy solution or workaround for this.

Thank you :-)

Boryana
Telerik team
 answered on 24 Aug 2012
2 answers
184 views
Hello Telerik,

I`m currently evaluating wether the ChartView could fit our needs.

Now I got stuck when trying to give the Y-values displayed in the Chart another format (currency):
I`m setting LineSeries instance properties "DisplayMember" without achieving an effect i.e. the values are displayed the same way as if DisplayMember  was not set (f.e. 4995148.92 instead of 4.995.148.92 €).

This is the code:

public partial class Form1 : Form
{
 
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        InitChartView();
    }       
 
    private void InitChartView()
    {
        var series1 = new LineSeries();
        series1.DisplayMember = "ValueFormatted";
        series1.ValueMember = "Value";
        series1.CategoryMember = "Category";
        series1.DataSource = Data.GetSomeDataYear1();
        series1.ShowLabels = true;
        radChartView1.Series.Add(series1);
 
        var series2 = new LineSeries();
        series2.ValueMember = "Value";
        series2.CategoryMember = "Category";
        series2.DisplayMember = "ValueFormatted";
        series2.DataSource = Data.GetSomeDataYear2();
        series2.ShowLabels = true;
        radChartView1.Series.Add(series2);
    }
}
 
public class SomeChartData
{
    public decimal Value { get; set; }
    public string ValueFormatted { get { return Value.ToString("C", CultureInfo.GetCultureInfo("de-DE")); } }
    public string Category { get; set; }
}
 
public static class Data
{
    public static IList<SomeChartData> GetSomeDataYear1(){
        return new List<SomeChartData>(){
            new SomeChartData() { Category = "Jan",        Value = 4845741.12M },
            new SomeChartData() { Category = "Feb",        Value = 4345642.41M },
            new SomeChartData() { Category = "März",       Value = 4237854.06M },
            new SomeChartData() { Category = "April",      Value = 4035341.33M },
            new SomeChartData() { Category = "Mai",        Value = 3843723.21M },
            new SomeChartData() { Category = "Juni",       Value = 4125344.42M },
            new SomeChartData() { Category = "Juli",       Value = 4443741.22M },
            new SomeChartData() { Category = "August",     Value = 4645530.42M },
            new SomeChartData() { Category = "September",  Value = 5144431.39M },
            new SomeChartData() { Category = "Oktober",    Value = 5034720.42M },
            new SomeChartData() { Category = "November",   Value = 5030842.98M },
            new SomeChartData() { Category = "Dezember",   Value = 4995148.92M }
        };
    }
}

Thanks in advance &
Best regards
Julian Benkov
Telerik team
 answered on 24 Aug 2012
10 answers
362 views
Hi Telerik,
I've downloaded SP2 for winforms controls and I wanna know if I can drag and drop only the celldata in the grid view.I saw the proprety columnchooser but it is not what I'm looking for.It helps when I wanna drog a column but in my case, I want to drog and drop only the content's cell.
Svett
Telerik team
 answered on 24 Aug 2012
1 answer
144 views
I hope to add this feature in the next version.
1.I want VisibleCheckBox Property
  if VisibleCheckBox is true then dropdowned item contain check box.
  and I want check all,uncheck all function .
Peter
Telerik team
 answered on 24 Aug 2012
1 answer
81 views
How to Adjust tool tip Height and Width?
Stefan
Telerik team
 answered on 24 Aug 2012
1 answer
200 views
plans to support the busy indicator?
Stefan
Telerik team
 answered on 24 Aug 2012
3 answers
185 views
How do I add, use, and include in my deployment a Custom Dictionary for use with radSpellChecker?  I have an internal use application where they use a lot medical words and I want to add a bunch in ahead of time for them.
Stefan
Telerik team
 answered on 24 Aug 2012
1 answer
201 views
When the user pulls a toolwindow out of the dock control so that it appears as its own window, the ParentForm property no longer points to the form it was docked in.  Does this mean dock windows can be dragged and dropped from one dock control to another, or is this a side-effect or bug of some sort?  Is there an alternative way to get the parent dock control where the window was pulled from after the fact?
Julian Benkov
Telerik team
 answered on 24 Aug 2012
4 answers
1.0K+ views
I have a requirement to set the tooltips on column headers for a databound RadGridView.

I have tried several ways to go about getting to the CellElement for the grid header row, the most promising of which was the GridView.MasterGridViewInfo.TableHeaderRow.Cells.  However, the CellElement is always null for these GridViewCellInfo objects.

Can someone recommend a way to accomplish this?

Thanks in advance,
Dave
Ragan
Top achievements
Rank 1
 answered on 23 Aug 2012
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Form
Chart (obsolete as of Q1 2013)
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
PdfViewer and PdfViewerNavigator
CommandBar
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
Label
AutoCompleteBox
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
Wizard
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
NavigationView
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
SmartPasteButton
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?