Telerik Forums
UI for WinForms Forum
7 answers
226 views
Hi.

I am using RadMenu when my menu root items count is more than of my parent container size i want to be scrolled.

what is your suggestion?
akhil
Top achievements
Rank 1
 answered on 27 Apr 2015
9 answers
202 views
When i have a medium length text to display in a MessageBox, the end of the text is being truncated. 
Such in the attached image file...

how to solve it, and how to give a theme into this messagebox?
Thanks in advance
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 27 Apr 2015
1 answer
64 views

Hi ,

I Need change date line to time line and time line to date line
as attachment image

 

thanks

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 27 Apr 2015
1 answer
97 views

Hello,

 

I have to DropDownList elements in my GridView. Everything is fine except, that the dropdownlist closes immediatly after I click on the scrollbar of the dropdownlist. So there is no way to an item with comfort.

 

Thanks for help

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 24 Apr 2015
3 answers
481 views

I have a databound grid.

When I right click on a row and choose "delete row" I want it to delete it in the database as well.

My code seems pretty simple:

private void radGridView1_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
      {
 
          if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
          {
                        
              DialogResult dr = MessageBox.Show("Are you sure?",
                  "Delete Row", MessageBoxButtons.YesNo);
              if (dr == DialogResult.Yes)
              {
                  e.Cancel = false;
                  this.radGridView1.EndUpdate();
                  this.rep_assigned_stop_matrixTableAdapter.Update(first_choice_mainDataSet);
              }
              else
              {
                  e.Cancel = true;
              }
               
          }
 
      }

 

It steps through it fine, the row is gone but the database does not get updated UNLESS I edit another field, then it calls this and it not only does the field edit but it also removes the row:

 

private void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e)
        {
 
            IEditableObject editbaleObject = e.Row.DataBoundItem as IEditableObject;
            DataRowView dataRowView = e.Row.DataBoundItem as DataRowView;
           
              if (editbaleObject != null)
            {
                editbaleObject.EndEdit();
            }
            if (dataRowView != null)
            {
                var test = dataRowView.DataView.Table;
                string whatiswas = test.ToString();
                string curTable = dataRowView.DataView.Table.ToString();
 
                if (dataRowView != null && this.allowEdits.Checked)
                {
                    if (curTable == "rep_info")
                    {
                        //this.rep_infoTableAdapter.Update(first_choice_mainDataSet.rep_info);
                        this.rep_infoTableAdapter.Update(dataRowView.Row);
                    }
                    else if (curTable == "rep_assigned_stop_matrix")
                    {
                        //this.rep_assigned_stop_matrixTableAdapter.Update(dataRowView.Row);
                        this.rep_assigned_stop_matrixTableAdapter.Update(first_choice_mainDataSet);
                    }
                }

Dimitar
Telerik team
 answered on 23 Apr 2015
1 answer
192 views

im trying to add a custom calculated field in my pivot following the intructions you give here 

http://www.telerik.com/help/winforms/pivotgrid-calculated-fields.html

 

here is my code and it doesnt work, any help?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.Pivot.Core;
using Telerik.Pivot.Core.Aggregates;
using Telerik.WinControls;

namespace GAR.Ventas
{
  public partial class frmPivot2 : Telerik.WinControls.UI.RadForm
  {
    public frmPivot2()
    {
      InitializeComponent();
    }

    public class Venta
    {
      public string Vendedor { get; set; }
      public string Cliente { get; set; }
      public string Zona { get; set; }
      public string Articulo { get; set; }
      public decimal Cantidad { get; set; }
      public decimal Precio { get; set; }
      public decimal Total { get { return Cantidad * Precio; } }
      public decimal Costo { get; set; }
      public decimal Margen { get { return Precio - Costo; } }
      public DateTime Fecha { get; set; }
    }

    public class Articulo
    {
      public string Descripcion { get; set; }
      public decimal Precio { get; set; }
      public decimal Costo { get { return Precio - (Precio * (SGS.Utils.convert.ToDecimal(20) / SGS.Utils.convert.ToDecimal(100))); } }
    }

    public class Cliente
    {
      public string Nombre { get; set; }
      public string Zona { get; set; }
    }


    public List<Venta> Ventas { get; set; }


    private void frmPivot2_Load(object sender, EventArgs e)
    {
      LocalDataSourceProvider provider;

      List<Cliente> Clientes = new List<Cliente>();
      List<Articulo> Articulos = new List<frmPivot2.Articulo>();
      List<Cliente> Vendedores = new List<Cliente>();

      Clientes.Add(new Cliente { Nombre = "JOSE PENA", Zona = "SANTO DOMINGO" });
      Clientes.Add(new Cliente { Nombre = "JUAN PEREZ", Zona = "SANTO DOMINGO" });
      Clientes.Add(new Cliente { Nombre = "JULIAN MONTERO", Zona = "SANTO DOMINGO" });

      Clientes.Add(new Cliente { Nombre = "SAMUEL AURELIO", Zona = "SANTIAGO" });
      Clientes.Add(new Cliente { Nombre = "SERGIO GUZMAN", Zona = "SANTIAGO" });
      Clientes.Add(new Cliente { Nombre = "JUAN CARLOS TEJEDA", Zona = "SANTIAGO" });
      Clientes.Add(new Cliente { Nombre = "LUIS CROUSSET", Zona = "SANTIAGO" });

      Clientes.Add(new Cliente { Nombre = "JOSE PERDOMO", Zona = "LA ROMANA" });
      Clientes.Add(new Cliente { Nombre = "ERIK GUTIERRES", Zona = "LA ROMANA" });
      Clientes.Add(new Cliente { Nombre = "ERICK GOMEZ", Zona = "LA ROMANA" });

      Articulos.Add(new Articulo { Descripcion = "CAJA DE BOLA", Precio = 100 });
      Articulos.Add(new Articulo { Descripcion = "JUEGO DE GOMAS AX100", Precio = SGS.Utils.convert.ToDecimal(123.44) });
      Articulos.Add(new Articulo { Descripcion = "CUARTO ACEITE CASTROL", Precio = SGS.Utils.convert.ToDecimal(1830.22) });
      Articulos.Add(new Articulo { Descripcion = "MICA DERECHA HONDA CIVIC", Precio = SGS.Utils.convert.ToDecimal(289.44) });
      Articulos.Add(new Articulo { Descripcion = "PANTALLA DELANTERA", Precio = SGS.Utils.convert.ToDecimal(2400.00) });
      Articulos.Add(new Articulo { Descripcion = "TAPA BOCINAS", Precio = SGS.Utils.convert.ToDecimal(1645.00) });
      Articulos.Add(new Articulo { Descripcion = "BOLA ESFERICA HONDA", Precio = SGS.Utils.convert.ToDecimal(999.99) });
      Articulos.Add(new Articulo { Descripcion = "FRENTIL NISSAN", Precio = SGS.Utils.convert.ToDecimal(1255) });
      Articulos.Add(new Articulo { Descripcion = "PUERTA DERECHA CIVIC 2000", Precio = SGS.Utils.convert.ToDecimal(1320.99) });
      Articulos.Add(new Articulo { Descripcion = "MONITOR 24", Precio = SGS.Utils.convert.ToDecimal(2800) });
      Articulos.Add(new Articulo { Descripcion = "LAPTOP ACER", Precio = SGS.Utils.convert.ToDecimal(23000.00) });


      Vendedores.Add(new Cliente { Nombre = "PEDRO CASTILLO" });
      Vendedores.Add(new Cliente { Nombre = "ERNESTO PASCUAL" });
      Vendedores.Add(new Cliente { Nombre = "CARLOS PAULINO" });
      Vendedores.Add(new Cliente { Nombre = "CARLO ACOSTA" });
      Vendedores.Add(new Cliente { Nombre = "GERONIMO MARTE" });
      Vendedores.Add(new Cliente { Nombre = "ANTHONY REYES" });

      Ventas = new List<Venta>();

      int idArticulo = 0;
      int idCliente = 0;
      int idVendedor = 0;
      Random rnd = new Random();
      for (int i = 0; i <= 10000; i++)
      {
        idArticulo = rnd.Next(1, 11);
        idCliente = rnd.Next(1, 10);
        idVendedor = rnd.Next(1, 6);

        Ventas.Add(new Venta
        {
          Articulo = Articulos[idArticulo].Descripcion
          ,
          Cantidad = rnd.Next(1, 100)
          ,
          Cliente = Clientes[idCliente].Nombre
          ,
          Zona = Clientes[idCliente].Zona
          ,
          Vendedor = Vendedores[idVendedor].Nombre
          ,
          Precio = Articulos[idArticulo].Precio
          ,
          Costo = Articulos[idArticulo].Costo
          ,
          Fecha = DateTime.Now.AddDays(rnd.Next(1, 200) * -1)
        });
      }

      provider = new LocalDataSourceProvider() { ItemsSource = Ventas  };
      provider.Culture = new System.Globalization.CultureInfo("es-DO");

      this.radPivotGrid1.DataProvider = provider;


      using (radPivotGrid1.PivotGridElement.DeferRefresh())
      {
        CommissionCalculatedField calculatedField = new CommissionCalculatedField();
        calculatedField.Name = "Commission";

        ((LocalDataSourceProvider)this.radPivotGrid1.DataProvider).CalculatedFields.Add(calculatedField);
      }




      this.radPivotGrid1.PivotGridElement.DataProvider.Refresh();
    }


    #region PRUEBA 1
    public class CommissionCalculatedField : CalculatedField
    {
      private RequiredField extendPriceField;

      public CommissionCalculatedField()
      {
        this.Name = "Commission";
        this.extendPriceField = RequiredField.ForProperty("Precio");
      }

      protected override IEnumerable<RequiredField> RequiredFields()
      {
        yield return this.extendPriceField;
      }

      protected override AggregateValue CalculateValue(IAggregateValues aggregateValues)
      {
        var aggregateValue = aggregateValues.GetAggregateValue(this.extendPriceField);
        if (aggregateValue.IsError())
        {
          return aggregateValue;
        }

        double extendedPrice = aggregateValue.ConvertOrDefault<double>();
        if (extendedPrice > 15000)
        {
          return new DoubleAggregateValue(extendedPrice * 0.1);
        }

        return null;
      }
    }
    #endregion
  }
}

Dimitar
Telerik team
 answered on 23 Apr 2015
4 answers
1.1K+ views

Hi,

I'm using gridview to list some important datas. After datas are listed, when i right clicked on the cell's, it shows a standard menu that contains copy, paste, cut, delete and some another options. But, i don't want that end users can cut or delete the cell's content even accidentally. I need only copy option. So, how can i remove that options except copy from that menu?   

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 21 Apr 2015
4 answers
92 views

Hello;

I have run out of ideas!

I have a simple parent/child databound grid.

The parent has a list of people, the child has a list of stores assigned to them.

I am wanting so that if I want to assign a new store they can click on "click here to add a new row" then have it work.

The attached picture should help.

In "Cust Stop No" they should be able to type in a number, then I want to do some validation to make sure it is a valid store ID.

If it is, i want to fill in the other columns of data.

I populate the grid here:

private void button1_Click(object sender, EventArgs e)
       {
           radGridView1.DataSource = null;
 
           rep_assigned_stop_matrixTableAdapter.FillByStopDetails(first_choice_mainDataSet.rep_assigned_stop_matrix);
 
           GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate);
           relation.ChildTemplate = childTemplate;
           relation.RelationName = "repStopRelationship";
           relation.ParentColumnNames.Add("id");
           relation.ChildColumnNames.Add("rep_id");
           radGridView1.Relations.Add(relation);
           radGridView1.DataSource = first_choice_mainDataSet.rep_info;
 
           //radGridView1.AutoGenerateHierarchy = true;
           radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
 
       }

Then I have tried to catch the cell change event here:

private void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e)
     {
 
         IEditableObject editbaleObject = e.Row.DataBoundItem as IEditableObject;
        
 
         DataRowView dataRowView = e.Row.DataBoundItem as DataRowView;
         var rowIndex = e.Row.Index;
         if (rowIndex == -1)
         {
             radGridView1.Rows[1].Cells["stop_name"].Value = "cityname";
 
         }

 

I am several hours in and not making any headway....please help!

Thank you,

 

Joe

Dimitar
Telerik team
 answered on 21 Apr 2015
1 answer
131 views
Is there any way to Export Excel with Column Groups.
Dimitar
Telerik team
 answered on 21 Apr 2015
1 answer
326 views

In the picture that I've attached you can see that the actual rows look fine with the white and blue color, just as i want them to look. However, the row grouping header is gray, and i can not for the life of me find a way to change the color of it. 

 

(I want to change the color of the grouping header in C# code)

 

Thanks

 

A.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 21 Apr 2015
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
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
NavigationView
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
SplashScreen
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?