Telerik Forums
UI for WinForms Forum
4 answers
308 views

I can't figure out how to do the following 2 things.

1. Set the width of the exported columns. They look ok in my grid in the WinForm, but when exported take up too much space.

2. How do I change the style of the column headers? I would like to bold it.

Here's my code.

private void btnExportVendorInvoices_Click(object sender, EventArgs e)
{
    using (SaveFileDialog dialog = new SaveFileDialog())
    {
        dialog.Filter = "Microsoft Excel (*.xlsx)|*.xlsx";
        dialog.FilterIndex = 2;
        dialog.RestoreDirectory = true;
 
        if (dialog.ShowDialog() == DialogResult.OK)
        {
 
            rgvInvoices.EnableAlternatingRowColor = true;
            var exporter = new ExportToExcelML(rgvInvoices);
            exporter.SheetMaxRows = ExcelMaxRows._1048576;
            exporter.HiddenColumnOption = HiddenOption.DoNotExport;
            exporter.ExportVisualSettings = true;
            exporter.ExcelCellFormatting += explorter_ExcelCellFormatting;
            exporter.RunExport(dialog.FileName);
            exporter.ExcelRowFormatting += exporter_ExcelRowFormatting;
 
            var dr = RadMessageBox.Show(this, "File has been saved, would you like to open it?",
                                        "File saved", MessageBoxButtons.YesNo, RadMessageIcon.Info);
            if (dr.ToString() == "Yes")
            {
                System.Diagnostics.Process.Start(dialog.FileName);
            }
        }
    }
}
 
 
private void explorter_ExcelCellFormatting(object sender, ExcelCellFormattingEventArgs e)
{
    if (e.GridCellInfo.RowInfo is GridViewDataRowInfo)
    {
        if (e.GridCellInfo.ColumnInfo.Name == "vendorFedId")
        {
            e.ExcelCellElement.Data.DataItem = string.Format("{0:00-0000000}", Convert.ToInt32(e.GridCellInfo.Value));
        }
    }
}
Dimitar
Telerik team
 answered on 24 Nov 2016
7 answers
148 views

Hi all,
i have a problem with a pivotgrid, as the title say i would like to add some filter conditions to my grid, below some lines of my code:

 

 this.radPivotGrid1.DataSource = LINQToDataTable(query);
            this.radPivotFieldList1.AssociatedPivotGrid = this.radPivotGrid1;

            this.radPivotGrid1.RowGroupDescriptions.Add(new PropertyGroupDescription() { PropertyName = "STATUS", GroupComparer = new GrandTotalComparer() });
            this.radPivotGrid1.ColumnGroupDescriptions.Add(new PropertyGroupDescription() { PropertyName = "SOMETHING", GroupComparer = new GrandTotalComparer() });
            this.radPivotGrid1.AggregateDescriptions.Add(new PropertyAggregateDescription() { PropertyName = "SOMETHING_ELSE", AggregateFunction = AggregateFunctions.Count });


            this.radPivotGrid1.AllowGroupFiltering = true;

            PropertyGroupDescriptionBase description = (PropertyGroupDescriptionBase)this.radPivotGrid1.RowGroupDescriptions[0];  //STATUS
            LabelGroupFilter filter = new LabelGroupFilter();
            TextCondition condition = new TextCondition();

            condition.Comparison = Telerik.Pivot.Core.Filtering.TextComparison.DoesNotContain;
            condition.Pattern = "SELLED";     <-------------- here i would like to insert more than one condition
            filter.Condition = condition;
            description.GroupFilter = filter;

as you can read in the comment i would like to say, for example: "Display only if my STATUS is not "SELLED" or "LOST"

There is a way to do it?

thank you very much

 

Andrea

Dimitar
Telerik team
 answered on 24 Nov 2016
9 answers
2.7K+ views

Hi,

Inthat scenario, when I try to edit the selected item, you'll see thelist.Selected Value is not changed.
But if you press button to get the Selected Value, you'll it's already = null.

It should keep the selected value, because it's needed to update data (text), using the id as value in a DB table..

public partial class RadForm2 : Telerik.WinControls.UI.RadForm
{
     
    RadDropDownList list = new RadDropDownList();
    TextBox tb = new TextBox();
    Button b = new Button();
 
    public RadForm2()
    {
        InitializeComponent();
        this.Controls.AddRange(new Control[] { list, tb, b });
 
        list.DropDownStyle = RadDropDownStyle.DropDown;
        list.Location = new Point(30, 30);
        list.Width = 100;
        list.Height = 25;
        list.DisplayMember = "name";
        list.ValueMember = "id";
        list.NullText = "not selected";
        list.SelectedValueChanged += list_SelectedValueChanged;
 
        tb.Location = new Point(30, 70);
        tb.Width = 100;
        tb.Height = 25;
 
        DataTable dt = new DataTable();
        dt.Columns.Add("id", typeof(int));
        dt.Columns.Add("name", typeof(string));
 
        dt.Rows.Add(1, "one");
        dt.Rows.Add(2, "two");
        dt.Rows.Add(3, "three");
        dt.Rows.Add(4, "four");
        dt.Rows.Add(5, "five");
        list.DataSource = dt;
 
        b.Location = new Point(30, 110);
        b.Width = 100;
        b.Height = 25;
        b.Text = "Get Selected Value";
        b.Click += b_Click;
    }
 
    void b_Click(object sender, EventArgs e)
    {
        tb.Text = list.SelectedValue + " <----> " + list.SelectedText;
    }
 
    void list_SelectedValueChanged(object sender, EventArgs e)
    {
        tb.Text = list.SelectedValue + " <----> " + list.SelectedText;
    }
}

 

Роберт
Top achievements
Rank 1
 answered on 23 Nov 2016
1 answer
182 views
We are interested in upgrading to the latest version of UI. Can we use the version of UI alongside an older version?

We are currently using UI for Winforms version 2011.2.11.0712.

Can we gradually upgrade our programs by including controls from the new version without interfering with controls using the older version?
Dimitar
Telerik team
 answered on 23 Nov 2016
4 answers
162 views

Is there any way to attach a picture before text of any any column ?

Regards

MSA

Dimitar
Telerik team
 answered on 23 Nov 2016
1 answer
117 views

Is there a way to fully cancel a user insert of a new row programatically?

I am looking to simulate the user hitting the esc key once initiating an insert of a new row.

Thanks,

 

Hristo
Telerik team
 answered on 22 Nov 2016
1 answer
163 views

Hello everybody,

I have a problem using the element visibilty property on ElementVisibility.Collapsed on the radgridview RowFormatting event.

When i try to put the row visibility to ElementVisibility.Collapsed, there is a strange behavior, the rows are not correctly displayed.

Here is a sample that reproduces the problem :

Imports Telerik.WinControls.UI
 
Public Class RadForm1
    Private _Liste As New List(Of MyClass1)
 
    Public Sub New()
 
        ' Cet appel est requis par le concepteur.
        InitializeComponent()
 
        ' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
        _Liste.Add(New MyClass1 With {.Prop1 = 10, .Prop2 = "AAA" & .Prop1})
        _Liste.Add(New MyClass1 With {.Prop1 = 10, .Prop2 = "BBB" & .Prop1})
        _Liste.Add(New MyClass1 With {.Prop1 = 10, .Prop2 = "CCC" & .Prop1})
        _Liste.Add(New MyClass1 With {.Prop1 = 100, .Prop2 = "DDD" & .Prop1})
        _Liste.Add(New MyClass1 With {.Prop1 = 100, .Prop2 = "FFF" & .Prop1})
        _Liste.Add(New MyClass1 With {.Prop1 = 1, .Prop2 = "QQQ" & .Prop1})
        _Liste.Add(New MyClass1 With {.Prop1 = 1, .Prop2 = "SSS" & .Prop1})
        RadGridView1.DataSource = _Liste
 
    End Sub
 
    Private Sub RadGridView1_RowFormatting(sender As Object, e As RowFormattingEventArgs) Handles RadGridView1.RowFormatting
        If DirectCast(e.RowElement.RowInfo.DataBoundItem, MyClass1).Prop1 = 10 Then
            e.RowElement.Visibility = Telerik.WinControls.ElementVisibility.Collapsed
        Else
            e.RowElement.Visibility = Telerik.WinControls.ElementVisibility.Visible
        End If
 
    End Sub
 
    Private Class MyClass1
        Public Property Prop1 As Integer
        Public Property Prop2 As String
    End Class
 
End Class

Maybe i'm missing something, but when i replace Telerik.WinControls.ElementVisibility.Collapsed by Telerik.WinControls.ElementVisibility.Hidden, i have the expected behavior (except that the rows are not collapsed).

 

Thanks in advance for your answers, and sorry for my aweful english ... I'm french.

 

I'm using Windows 7 64 bits, with 2016.3.1024.40 version of radcontrols, and .Net Framework v4

Ralitsa
Telerik team
 answered on 22 Nov 2016
1 answer
215 views

Hi. I understand that we need to create new themes for each different appearance of a control (eg button) unless it's done in the designer etc.

It's of concern that each of the theme packets is pretty large eg 500k in size and seems an awful waste of disk space if a whole theme needs to be generated for the sake of a single control where, in my case, I'm using 4 - 5 different shaped/coloured buttons on a single form, this is the first one I'm changing to telerik out of several hundred forms in the application.

Am I understanding this correctly? Or is it possible to strip a theme packet down to cover a selection of controls with just what's needed by those controls?

If so then is it possible to add changing the functionality of the themes/visual designer to the 'wish list' for a future version please :)

Dimitar
Telerik team
 answered on 22 Nov 2016
5 answers
354 views

Hello , I am Aung Ko .

I am getting the Null Reference exception in rad grid view , first i has been filled data in gridview after filling data may be one row or two row in which I has been clicked in Group Type Column in gridview  at this time I has been seen Null Reference exception. I can't handled this exception. How can I do for this exception. Please , Suggest to me.

Thanks.

This is my sample project Link.

https://drive.google.com/file/d/0B0PjZMmehto4ZXl1dkRIa29qdG8/view?usp=sharing

Dimitar
Telerik team
 answered on 21 Nov 2016
12 answers
262 views

I'm complete new to the Winforms. I use Progress/OpenEdge 11.6.

I build the "getting started" Example and tried to customize it.

My questions:

Is it possible to disable the context menu (Close, close all ...) for the last shown Tab, because I want one Tab always stay open?

Is it possible to float out a complete document container with all document windows in it?

When I autohide as Document, is it possible to put the information to the bottom of the form?

When I set the CloseAction to "Hide" is there a build in function to manage then hidden Documents?

Thank yout for answers

Jürgen

 

Mark
Top achievements
Rank 1
 answered on 18 Nov 2016
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
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
CollapsiblePanel
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
Styling
Barcode
PopupEditor
RibbonForm
TaskBoard
Callout
NavigationView
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Security
LocalizationProvider
Dictionary
SplashScreen
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?