Telerik Forums
UI for WinForms Forum
1 answer
968 views
I have a grid with a column of GridViewCommandColumn and I wish to programmatically disable certain buttons.

I'm after something akin to;

foreach (Telerik.WinControls.UI.GridViewRowInfo gridItem in HeaderGridview.Rows)
{
    if (gridItem.Cells["Send"].Value.ToString() == "TO BE SENT")
        gridItem.Cells["Resend"].Enabled = false;
 }

I've googled it to death and can't find any samples anywhere.

Anyone got an ideas?

Richard Slade
Top achievements
Rank 2
 answered on 27 Apr 2012
1 answer
147 views
Let's say I have two series on a RadChart -- values versus time.  Is there a built-in function I can use to generate a third series which is the average of the first two series?  I want to be able to take N individual series and show the average of all N series as a single series.  Can I do this?
Evgenia
Telerik team
 answered on 27 Apr 2012
3 answers
167 views
Hello,
I downloaded the Winforms install file (RadControlsForWinFormsSetup_2012_1_321.exe); when i run this file a window appear but the WinForms option show "cannot be install"

My SO is WinVista Bussines 32 bits
I have installed VS2005 and VS2008

How can i to install RadControlsForWinForms?

Regards.
Jorge
Top achievements
Rank 1
 answered on 27 Apr 2012
2 answers
169 views
A calculator in comboxbox  would be very usefull!!
Javier Gonzalez de Aragon
Top achievements
Rank 2
 answered on 27 Apr 2012
1 answer
157 views
I followed demo on: http://www.telerik.com/help/winforms/scheduler-appointments-and-dialogs-adding-a-custom-field-to-the-editappointment-dialog.html

Attached is the code behind. Somehow, when I ran the email filed not populated/show up.

Kindly advise what I did wrong.

Thank you very much.

 

 

 

 

 

 

Dave Mortgatta
Top achievements
Rank 1
 answered on 26 Apr 2012
3 answers
607 views

Hi there,

I am currently developing an MDI application exploiting your Raddock Control.

As I am using forms as tabbed windows, I would like my application not to create a new tab (a second one), if the form is already open.

Currently I am using the following workaround and nonetheless I don’t like very much this way J


private void AddTabbedForm(BaseForm form)
{
    if (this.radDock1.DockWindows.DocumentWindows.Where(w => w.Text == form.Text).Count() > 0)
    {
        this.radDock1.ActivateWindow(this.radDock1.DockWindows.DocumentWindows.Where(w => w.Text == form.Text).First());
        return;
    }
      form.MdiParent = this;
    form.Show();
}
 


Any hint to have it implemented in a more elegant way?


Thank you very much
Davide
Richard Slade
Top achievements
Rank 2
 answered on 26 Apr 2012
1 answer
254 views

A few threads have been posted over the years to ask about natural sorting, which is clicking a column header to go Ascending, Descending, then back to the default unsorted mode on the third click. I looked around for a tri-state or three-state toggle and didn't find any info.  Very helpful but incomplete info is found here and here, so I thought I'd provide C# code to help anyone else looking to do this. Some threads refer to MasterGridViewTemplate.AllowNaturalSort but that property no longer exists. My code is adapted from the second forum posting referenced. It looks like the library has changed since Sean wrote his code.

Telerik.WinControls.Data.SortDescriptor.Direction is of type System.ComponentModel.ListDirection, and that enum only has two values. So the Boolean _sorted is used - if the grid is sorted in ascending or descending order, then use the sort order, but  if we click past descending order, set _sorted to false (natural sort!) and clear the SortDescriptors.

Of course clearing SortDescriptors means this only works with single column sorting. Maybe someone will follow-up here with a solution that works with multiple columns.

HTH

using System.ComponentModel;
bool _sorted = false;
ListSortDirection _previousGridColumnSortDirection;
private void radGridView1_SortChanging(object sender, GridViewCollectionChangingEventArgs e)
{
    try
    {
        Telerik.WinControls.Data.SortDescriptor sortField;
        // Only proceed if we are changing an existing sorting (not starting a new one) 
  
        // Make sure we have an item
        if (e.NewItems != null && e.NewItems.Count > 0)
        {
            sortField = (Telerik.WinControls.Data.SortDescriptor)e.NewItems[0];
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.ItemChanging)
            {
                // If the current SortOrder is Ascending, and the previous SortOrder
                // was Descending, then clear the sorting.
                if (_sorted)
                {
                    if (sortField.Direction == ListSortDirection.Ascending &&
                        _previousGridColumnSortDirection == ListSortDirection.Descending)
                    {
                        _sorted = false;
                        radGridView1.MasterGridViewTemplate.SortDescriptors.Clear();
                    }
                    //Save the SortOrder for the next iteration
                    _previousGridColumnSortDirection = sortField.Direction;
                }
                else
                {
                    _sorted = true;
                    _previousGridColumnSortDirection = sortField.Direction;
                }
            }
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add)
            {
                _sorted = true;
                _previousGridColumnSortDirection = sortField.Direction;
            }
        }
  
    }
    catch
    {
    }
}
Julian Benkov
Telerik team
 answered on 26 Apr 2012
1 answer
121 views

Hello,

I have Winform RadGridView with grouped columns header. I will wrap the long text.

radGridView1.AutoSizeRows = true;
radGridView1.Columns["column1"].WrapText = true;
radGridView1.Columns["column1"].Multiline = true;

Error after view definition, See picture in attach.
Without grouped columns header works well.
Any suggestions?

Regards,
Elek

Svett
Telerik team
 answered on 26 Apr 2012
5 answers
1.0K+ views
Please see the picture in attachment.

Can I add "Add Node" button in every node?
Rather than, user choose >> right click >> click New >> key in.

Is possible?
Thank You.
Stefan
Telerik team
 answered on 26 Apr 2012
3 answers
299 views
Hey Guys

I have a problem where i wish to add logic into the CreateChildElements method which, based on the value of a given cell in the row will display different controls.

When CreateChildElements is called, the GridViewColumn and GridRowElement (which have been set in the contructor) are Null, as if they are not in the same context.

This is what i currently have (Please notice the CreateChildElements Method)
#region GridDataCellElement
 public class GridDataCustomCellElement : GridDataCellElement
 {
     #region Locals
     private RadImageButtonElement radButtonElementViewOrder;
     private RadImageButtonElement radButtonElementNewOrder;
     public GridViewColumn thisColumn;
     public GridRowElement thisRow;
     #endregion
 
     #region Constructors
      
     public GridDataCustomCellElement(GridViewColumn col, GridRowElement row) : base(col, row) { thisColumn = col; thisRow = row;}
     #endregion
 
     #region Events
 
     void radButtonElementNewOrder_Click(object sender, EventArgs e)
     {
 
         Main newOrder = new Main(GetFolderPath(thisRow.GridControl.CurrentRow.Cells[2].Value.ToString()) + "\\" + thisRow.GridControl.CurrentRow.Cells[0].Value.ToString());
         newOrder.MyParentForm = (SalesOrderingClient.Home)thisRow.GridControl.FindForm();
         newOrder.IsCopyOrder = true;
         newOrder.ShowDialog();
     }
 
     void radButtonElementViewOrder_Click(object sender, EventArgs e)
     {
         // Build order object
         SalesOrderingObjects.Order objOrder = SalesOrderingObjects.Order.LoadOrder(GetFolderPath(thisRow.GridControl.CurrentRow.Cells[2].Value.ToString()) + "\\" + thisRow.GridControl.CurrentRow.Cells[0].Value.ToString());
 
         // Build session object
         Session s = new Session(objOrder);
 
         // Display Order
         Order o = new Order(s);
         o.ShowDialog();
     }
 
     #endregion
 
     #region Overrides
      
     /// <summary>
     /// Create new controls and add them to cell
     /// </summary>
     protected override void CreateChildElements()
     {
         // Set up controls and add them to this cell
 
         Home h = new Home();
          
 
         radButtonElementViewOrder = new RadImageButtonElement();
         radButtonElementViewOrder.ButtonFillElement.BackColor = Color.Transparent;
         radButtonElementViewOrder.ButtonFillElement.BackColor2 = Color.Transparent;
         radButtonElementViewOrder.ImageAlignment = ContentAlignment.MiddleRight;
         radButtonElementViewOrder.BorderElement.Width = 0;
         radButtonElementViewOrder.Image = h.IconImageLIst.Images[1];
         radButtonElementViewOrder.ToolTipText = "View Order";
          
         this.Children.Add(radButtonElementViewOrder);
 
         radButtonElementNewOrder = new RadImageButtonElement();
         radButtonElementNewOrder.ButtonFillElement.BackColor = Color.Transparent;
         radButtonElementNewOrder.ButtonFillElement.BackColor2 = Color.Transparent;
         radButtonElementNewOrder.ImageAlignment = ContentAlignment.MiddleRight;
         radButtonElementNewOrder.BorderElement.Width = 0;
         radButtonElementNewOrder.Image = h.IconImageLIst.Images[0];
         radButtonElementNewOrder.ToolTipText = "Copy Order";
         this.Children.Add(radButtonElementNewOrder);
 
         radButtonElementNewOrder.Click += new EventHandler(radButtonElementNewOrder_Click);
         radButtonElementViewOrder.Click += new EventHandler(radButtonElementViewOrder_Click);
     }
 
 
 
 
 
     /// <summary>
     /// Set size and position of controls in the cell
     /// </summary>
     /// <param name="finalSize"></param>
     /// <returns></returns>
     protected override SizeF ArrangeOverride(SizeF finalSize)
     {
         // If there are more than 1 controls in this cell
         //if (this.Children.Count == 3)
         //{
             // Setup dimensions and position and modifiy controls
         RectangleF btn1 = new RectangleF(20, 12, 36, 36);
         RectangleF btn2 = new RectangleF(58, 12, 36, 36);
 
          
         this.Children[0].Arrange(btn1);
         this.Children[1].Arrange(btn2);
         //}
 
         return finalSize;
     }
 
     /// <summary>
     /// Set the cells theme, if not done, cell does not inherit theme as it is custom
     /// </summary>
     protected override Type ThemeEffectiveType
     {
         get
         {
             return typeof(GridDataCellElement);
         }
     }
 
     public override bool IsCompatible(GridViewColumn data, object context)
     {
         return data is RadLabelColumn && context is GridDataRowElement;
     }
 
     #endregion
 
     #region Private Methods
 
     /// <summary>
     /// Get folder path based on XML status
     /// </summary>
     /// <param name="status"></param>
     /// <returns></returns>
     string GetFolderPath(string status)
     {
         string folder = string.Empty;
         switch (status)
         {
             case "Saved":
                 folder = Common.SavedOrdersFolder;
                 break;
             case "InProgress":
                 folder = Common.InProgressOrdersFolder;
                 break;
             case "Sent":
                 folder = Common.SentOrdersFolder;
                 break;
             case "Requested":
                 folder = Common.RequestedOrdersFolder;
                 break;
             default:
                 folder = Common.UserDataBaseFolder;
                 break;
         }
         return folder;
     }
 
     #endregion
 
 }
 #endregion

This is what i would like to do:
protected override void CreateChildElements()
{
    // Set up controls and add them to this cell
 
    Home h = new Home();
     
    switch(SOMETHING GOES HERE)
    {
        case ?:
        radButtonElementViewOrder = new RadImageButtonElement();
        radButtonElementViewOrder.ButtonFillElement.BackColor = Color.Transparent;
        radButtonElementViewOrder.ButtonFillElement.BackColor2 = Color.Transparent;
        radButtonElementViewOrder.ImageAlignment = ContentAlignment.MiddleRight;
        radButtonElementViewOrder.BorderElement.Width = 0;
        radButtonElementViewOrder.Image = h.IconImageLIst.Images[1];
        radButtonElementViewOrder.ToolTipText = "View Order";
        this.Children.Add(radButtonElementViewOrder);
 
        radButtonElementNewOrder = new RadImageButtonElement();
        radButtonElementNewOrder.ButtonFillElement.BackColor = Color.Transparent;
        radButtonElementNewOrder.ButtonFillElement.BackColor2 = Color.Transparent;
        radButtonElementNewOrder.ImageAlignment = ContentAlignment.MiddleRight;
        radButtonElementNewOrder.BorderElement.Width = 0;
        radButtonElementNewOrder.Image = h.IconImageLIst.Images[0];
        radButtonElementNewOrder.ToolTipText = "Copy Order";
        this.Children.Add(radButtonElementNewOrder);
 
        radButtonElementNewOrder.Click += new EventHandler(radButtonElementNewOrder_Click);
        radButtonElementViewOrder.Click += new EventHandler(radButtonElementViewOrder_Click);
        break;
        case ?:
            // ADD SOME DIFFERENT CONTROLS
        break;
    }
 
 
}

Please tell me if this is possible, or if there is an alternative way of doing this?

Many Thanks
Tim





Ivan Petrov
Telerik team
 answered on 26 Apr 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?