Telerik Forums
UI for WinForms Forum
7 answers
930 views
I m using radgridview. I want to auto size the every column by its header text automatically. Is it possible.

Please help.
Boryana
Telerik team
 answered on 27 Aug 2012
4 answers
175 views
Hello,

I am using on every grid view in our application LoadLayout and SaveLayout.

On most grids all works fine, but on one of our grids I am getting a NullReferenceException.


The grid has a lot of columns and includes look up columns. When I try and load the layout for this particular grid, I am getting the following NullReferenceException

Object reference not set to an instance of an object.

at Telerik.WinControls.Data.FilterExpressionCollection.GetFieldByName(String fieldName)

at Telerik.WinControls.Data.FilterExpression.set_Owner(FilterExpressionCollection value)

at Telerik.WinControls.Data.FilterExpressionCollection.InsertItem(Int32 index, FilterExpression item)

at System.Collections.ObjectModel.Collection`1.Add(T item)

at Telerik.WinControls.Data.Field.set_Filter(FilterExpression value)

at Telerik.WinControls.Data.Field.Initialize(Field field)

at Telerik.WinControls.UI.GridViewDataColumn.set_Field(Field value)

at Telerik.WinControls.Data.DataAccessComponent.EnsureColumns()

at Telerik.WinControls.Data.DataAccessComponent.UpdateColumns(NotifyCollectionChangedEventArgs e)

at Telerik.WinControls.UI.GridViewTemplate.UpdateColumns(NotifyCollectionChangedEventArgs e)

at Telerik.WinControls.UI.GridViewColumnCollection.NotifyListenersCollectionChanged(NotifyCollectionChangedEventArgs e)

at Telerik.WinControls.Data.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)

at Telerik.WinControls.Data.ObservableCollection`1.EndUpdate(Boolean notifyUpdates)

at Telerik.WinControls.Data.ObservableCollection`1.EndUpdate()

at Telerik.WinControls.UI.GridViewLayoutSerializer.ProcessListOverride(XmlReader reader, Object listOwner, PropertyDescriptor ownerProperty, IList list)

at Telerik.WinControls.XmlSerialization.ComponentXmlSerializer.ReadElementInObject(XmlReader reader, PropertyDescriptor property, Object toRead)

at Telerik.WinControls.XmlSerialization.ComponentXmlSerializer.ReadObjectElement(XmlReader reader, Object parentObject, Object toRead)

at Telerik.WinControls.XmlSerialization.ComponentXmlSerializer.ReadElementInObject(XmlReader reader, PropertyDescriptor property, Object toRead)

at Telerik.WinControls.XmlSerialization.ComponentXmlSerializer.ReadObjectElement(XmlReader reader, Object parentObject, Object toRead)

at Telerik.WinControls.XmlSerialization.ComponentXmlSerializer.ReadObjectElement(XmlReader reader, Object toRead)

at Telerik.WinControls.UI.RadGridView.LoadLayout(String fileName)

at Multepos.Controls.GridView.LoadLayout(GridViewName gridViewName) in C:\Users\Richard\Documents\Visual Studio 2005\Projects\Multepos.Controls\GridView\GridView.vb:line 392

at Multepos.HeadOffice.UI.Forms.FileAdmin.Master.Master_Shown(Object sender, EventArgs e) in C:\Users\Richard\Documents\Visual Studio 2005\Projects\Multepos.HeadOffice.UI\Forms\File Admin\Master.vb:line 69

at System.Windows.Forms.Form.OnShown(EventArgs e)

at System.Windows.Forms.Form.CallShownEvent()

at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)

at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)

at System.Threading.ExecutionContext.runTryCode(Object userData)

at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)

Jack
Telerik team
 answered on 27 Aug 2012
9 answers
498 views
Hi,

I get an error when trying to create a new winforms project in Visual Studio 2010 (SP1 applied).
First I start the wizard to create the new project: Telerik->RadControls for WinForms->Create New telerik Project.
Next I select a VB RadControls Windows Forms Application and enter a Name, Location and Solution name. (same happens when creating a C# app)
After pressing OK this error message appears:

Method 'GetProjectWrap' in type 'telerik.WinControls.VSX.ProjectConfigurators.NewProjectConfigurator'
from  assembly 'telerik.WinControls.VSX, Version=2011.2.419.0
, Culture-neutral, PublicKeyToken=0dfdc51bd06071b4' does not have an 
implementation.

The error occured when RadControls for ASP.NET AJAX was installed on the same machine?!?!

I uninstalled and cleaned vs extensions numerous times. When only installing RadControls_WinForms_2011_1_11_419_dev.msi there's no error.

When RadControls_WinForms_2011_1_11_419_dev.msi is installed (first or after doesn't matter) combined with Telerik.Web.UI_2011_1_413_Dev.msi the error mentioned above appears.

A little help would be appreciated. It seems vs2008 doesn't have this issue ?!
Andrey
Telerik team
 answered on 27 Aug 2012
4 answers
129 views
Hello...
           I wanna put my DateTime value in raddatetimepicker control which im unable to do like visualstudios DTP control. Can u suggest me?
Roberto
Top achievements
Rank 1
 answered on 27 Aug 2012
4 answers
101 views
I looked through the forums and haven't see anything on this, so I thought I'd post a new post to see if there's an answer or a work-around for my issue.

Summary:  If I, at runtime, choose a new DataSource that shares common Column Names with my current DataSource, only the columns with shared names are shown.  If there are no shared column names, then all columns are displayed.  Note, that I've only tried this with DataTable objects.

How to Reproduce:  Given the following four DataTables (with column names listed.)

TableA : (ID, NAME, DESC)
TableB : (ID, NAME, LOCATION)
TableC : (ITEMID, COUNT)
TableD : (NAME, COUNT)

a) RadGridView.DataSource = "TableA" -> All columns are shown.
b) RadGridView.DataSource = "TableB" -> Only ID and NAME are shown
c) RadGridView.DataSource = "TableC" -> All columns are shown.
d) RadGridView.DataSource = "TableD" -> Only COUNT is shown.

If this is a bug, would you happen to know of a workaround in the meantime?

If you need more information, please let me know.

Thanks!

Rob


Stefan
Telerik team
 answered on 27 Aug 2012
18 answers
683 views
I searched around the forums and couldn't find any info on how to have a nullable DateTime in a GridViewDateTimeColumn. 

I want the user to be able to null out the date and save it to the DB as null.  There seems to be no way to do this.  The GridViewDateTimeColumn seems to not allow the user to select no date or allow them to remove the date from the cell.

We're binding to business objects that have DateTime? as a property.

Is there a way to do this in the GridView for Winforms?  thanks
Ranjeeth kumar
Top achievements
Rank 1
 answered on 27 Aug 2012
3 answers
127 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
364 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
131 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
316 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
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)
Chart (obsolete as of Q1 2013)
Form
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
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
NavigationView
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?