Telerik Forums
UI for WinForms Forum
4 answers
162 views
Greetings!

I'd love to know if there's a problem with my code or if this is some kind of bug in the GridView, as the result is very strange.

If I create a custom column by inheriting GridViewDataColumn, the cell for that column will appear correctly in its own column, but will also occasionally appear in other columns.

Steps to reproduce
This is not my actual implementation, but a much simplified bit of code that reproduces the problem - the custom column here just displays a button for testing purposes.

I am running Telerik Controls for Windows Forms 2010.3.10.1215

Create a form called "ManualBuildTest" with a RadGridView on it, called "Grid" (Dock: Fill). Then use the following code in the form:

 

 

 

public partial class ManualBuildTest : Form
{
    public ManualBuildTest()
    {
        InitializeComponent();
    }
    private void ManualBuildTest_Load(object sender, EventArgs e)
    {
        var col1 = new DataLinkColumn(string.Empty);
        col1.AllowGroup = true;
        col1.HeaderText = "Requested By";
        Grid.Columns.Add(col1);
        var col = new GridViewTextBoxColumn();
        col.AllowGroup = true;
        col.ReadOnly = false;
        col.HeaderText = "Position";
        Grid.Columns.Add(col);
        col = new GridViewTextBoxColumn();
        col.AllowGroup = true;
        col.ReadOnly = false;
        col.HeaderText = "Organisation";
        Grid.Columns.Add(col);
        col = new GridViewTextBoxColumn();
        col.AllowGroup = false;
        col.ReadOnly = false;
        col.HeaderText = "Work Phone";
        Grid.Columns.Add(col);
        col = new GridViewTextBoxColumn();
        col.AllowGroup = false;
        col.ReadOnly = false;
        col.HeaderText = "Mobile";
        Grid.Columns.Add(col);
        col = new GridViewTextBoxColumn();
        col.AllowGroup = false;
        col.ReadOnly = false;
        col.HeaderText = "E-Mail";
        Grid.Columns.Add(col);
        col = new GridViewTextBoxColumn();
        col.AllowGroup = false;
        col.ReadOnly = false;
        col.HeaderText = "Fax";
        Grid.Columns.Add(col);
        var dcol = new GridViewDateTimeColumn();
        dcol.AllowGroup = true;
        dcol.ReadOnly = false;
        dcol.HeaderText = "Date Requested";
        Grid.Columns.Add(dcol);
        col = new GridViewTextBoxColumn();
        col.AllowGroup = true;
        col.ReadOnly = false;
        col.HeaderText = "Request";
        Grid.Columns.Add(col);
        col = new GridViewTextBoxColumn();
        col.AllowGroup = true;
        col.ReadOnly = false;
        col.HeaderText = "Status";
        Grid.Columns.Add(col);
        col = new GridViewTextBoxColumn();
        col.AllowGroup = true;
        col.ReadOnly = false;
        col.HeaderText = "Assigned To";
        Grid.Columns.Add(col);
        dcol = new GridViewDateTimeColumn();
        dcol.AllowGroup = true;
        dcol.ReadOnly = false;
        dcol.HeaderText = "Request Completed";
        Grid.Columns.Add(dcol);
        col = new GridViewTextBoxColumn();
        col.AllowGroup = true;
        col.ReadOnly = false;
        col.HeaderText = "Result of Request";
        Grid.Columns.Add(col);
        Grid.Rows.AddNew();
        Grid.Rows.AddNew();
    }
}
public class DataLinkColumn : GridViewDataColumn
{
    public DataLinkColumn(string fieldName)
        : base(fieldName)
    {
    }
    public override Type GetCellType(GridViewRowInfo row)
    {
        if (row is GridViewDataRowInfo)
            return typeof(DataLinkCellElement);
        return base.GetCellType(row);
    }
}
public class DataLinkCellElement : GridDataCellElement
{
    private RadButtonElement _ctlButton;
    public DataLinkCellElement(GridViewColumn column, GridRowElement row)
        : base(column, row)
    {
    }
    protected override void CreateChildElements()
    {
        base.CreateChildElements();
        _ctlButton = new RadButtonElement();
        _ctlButton.Text = "TEST";
        _ctlButton.ShowBorder = true;
        Children.Add(_ctlButton);
    }
    protected override void SetContentCore(object value)
    {
        _ctlButton.Text = value == null ? "(null)" : value.ToString();
    }
}

If you then run the form, everything (usually) looks fine at first: the custom column appears in the first column as set (the cell contains a button with the word "(null)" in it for now).

But if you make sure that the window is small enough that the Grid's horizontal scrollbar appears, and scroll back and forth, the custom button is appearing in other cells sporadically (see the attachment for an example).

I've tried to match my code to existing code examples, and even tried it with the RadRadioButtonCellElement custom column from the Knowledge Base, and got the same result.

Is there something fundamentally wrong with my code?

FRASER TUSTIAN

 

Jack
Telerik team
 answered on 20 Jan 2011
8 answers
214 views

Hi

In 2010 Q2 SP2 in row for adding new rows there was text: Click here to add new row (or very similar). This text is missing in Q3 by default. How can I display this text in Q3 (in row for adding new rows)?

Reagrds

Jack
Telerik team
 answered on 20 Jan 2011
3 answers
243 views
Hi,
Which control should i use in place of Tab,Because Tab control is obsolete in 2010.
Ivan Petrov
Telerik team
 answered on 20 Jan 2011
1 answer
263 views
I have a treeview control bound to a BindingList.  If I call .Remove() on one of the tree nodes, should it delete the underlying item in the BindingList?  I checked the count before and after calling .Remove, and the count on the bindinglist is the same.  I want the item to be deleted, so what do I need to do differently?  Also, I have tried removing the items from the underlying BindingList, and have noticed that the tree nodes are not removed.  I can add nodes to the bindinglist, and they will show up as new tree nodes, but I am having issues with removal.  Thanks for any help!
Julian Benkov
Telerik team
 answered on 20 Jan 2011
1 answer
366 views
Hello. I was trying setup a currency (C2) and a numeric custom mask (1 day, 5 days etc) for a SpinEdit and found that there is no direct support for masking. Instead, we have to use MaskedEdit for direct masking. Anyhow, I have easily setup the C2 mask for a MaskedEdit but I'm missing the Up/Down buttons and the built it Min/Mav value limits. On the other hand, I need to display a number post-fixed with " days". For example, user will enter "1" but the display will be like "1 days". Again, needed to have a Min/Max values limit here but can't get the desired from SpinEdit.

Objectives:
  • Easy Masking for SpinEdit (If possible)
  • Using SpinEdit or MaskEdit, Have custom mask: "1 day" or "10 days"
Martin Vasilev
Telerik team
 answered on 20 Jan 2011
4 answers
235 views
I'm familiar with making my own themes, but the SpinEditor does not seem to accept new colors for the "up/down arrows". I want a new fill color for those buttons.

I also followed the Spin Editor Styling Tutorial, but again nothing changes the arrow buttons from their default blue shading. Also, when I'm in the Visual Style Builder's design mode, the display of the button does not change at all as I pick the various "state" tabs. Everything works great with other controls, just not the spin editor. ??? - Aussie
Ivan Petrov
Telerik team
 answered on 20 Jan 2011
2 answers
132 views
I have to export data from RadGridView to excel . I used RadGridViewExcelExporter class. How can I do to format for datetime column and to make alignment of cells in excel? Thanks.
Richard Slade
Top achievements
Rank 2
 answered on 20 Jan 2011
1 answer
222 views
Hello,

We have a gird with Excel-Like filtering enabled.
Is there a way to disable the Excel-Like filtering for certain columns only? For example, in some cases with many different dollar values in a column, it doesn't really make sense for the user to be able filter based on specific values only, not to mention that there is some kind of a rounding bug where you would check only one value in the list and it won't display any rows...
We still want to keep the old style filtering capabilities because they make more sense for some columns and disable only the Excel-Like functionality...
Again, we need to be able to do that on per column basis, not for the grid as a whole.

See screenshot for more details

Thanks in advance.

Richard Slade
Top achievements
Rank 2
 answered on 19 Jan 2011
3 answers
243 views
We are having a problem using LoadLayout with RadGrid after releasing a new version that has new columns added. It seems that LoadLayout completely replaces the original columns with those listed in the layout XML file, and the new columns are gone. They are not just hidden, they have been completely removed.

The only way that we have been able to solve this problem is to rename the XML file with every release, causing the previous saved layout to be ignored. This is very irritating to users because they may have made several changes to the default column layout and after an upgrade they have to start over.

Is there a way to still use LoadLayout to preserve the user's column and grouping preferences, but not destroy newly added columns?
Richard Slade
Top achievements
Rank 2
 answered on 19 Jan 2011
8 answers
822 views
Hello All,
I have a rad gridview for winforms. I am using Q3 SP 2010. I am trying to display NO DATA FOUND when we dont find any data in the dataset. I had a look at other forms and tried doing this.
me.radgridview.TableElement.Text="No data found"
But I am not able to access the "TableELement" property. I know with telerik it would be some where down the hierarchy. Any help would be great. Thanks in advance.
Richard Slade
Top achievements
Rank 2
 answered on 19 Jan 2011
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
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
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
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?