Telerik Forums
UI for WinForms Forum
3 answers
185 views
We use a RadGridView on our WinForms application. We are trying to add filtering, but nothing behaves the way we want it to.

When I go to the filter -> Available Filters -> Equals, I would expect it to load the form with the appropriate options prefilled (i.e., equal to today). However, the form lacks values and does not adapt for which filter I select.

Here's my code so far:

Private Sub radGridView1_CreateCompositeFilterDialog(e As GridViewCreateCompositeFilterDialogEventArgs, senderName As String, column As GridViewDataColumn)
    Dim filterDialog As CompositeFilterForm
    Dim compositeFilterDescriptor As CompositeFilterDescriptor
 
    If senderName.ToLower() = "equals" Then
        compositeFilterDescriptor = New CompositeFilterDescriptor()
        compositeFilterDescriptor.LogicalOperator = FilterLogicalOperator.Or
        compositeFilterDescriptor.IsFilterEditor = True
        compositeFilterDescriptor.FilterDescriptors.Add(New DateFilterDescriptor("colReceived", FilterOperator.IsEqualTo, Date.Now) With {
                                                        .IsFilterEditor = True,
                                                        .IgnoreTimePart = True
        })
        compositeFilterDescriptor.FilterDescriptors.Add(New DateFilterDescriptor("colReceived", FilterOperator.IsEqualTo, Date.Now) With {
                                                        .IsFilterEditor = True,
                                                        .IgnoreTimePart = True
        })
    ElseIf senderName.ToLower() = "not equal to" Then
        compositeFilterDescriptor = New CompositeFilterDescriptor()
        compositeFilterDescriptor.LogicalOperator = FilterLogicalOperator.And
        compositeFilterDescriptor.NotOperator = True
        compositeFilterDescriptor.IsFilterEditor = True
        compositeFilterDescriptor.FilterDescriptors.Add(New FilterDescriptor("colReceived", FilterOperator.IsEqualTo, Date.Now))
        compositeFilterDescriptor.FilterDescriptors.Add(New FilterDescriptor("colReceived", FilterOperator.None, Nothing))
    ElseIf
        ....
    End If
 
    If compositeFilterDescriptor IsNot Nothing Then
        filterDialog = New CompositeFilterForm(column, compositeFilterDescriptor)
    Else
        filterDialog = New CompositeFilterForm()
    End If
    AddHandler filterDialog.FormClosing, AddressOf test2
    e.Dialog = filterDialog
End Sub

This is subscribed to in the MouseUp event of any of the Available Filter menu items (which has some custom values passed in through a lambda):

Private Sub item_MouseUp(sender As Object, column As GridViewDataColumn)
        AddHandler radGridView1.CreateCompositeFilterDialog, Sub(s As Object, e2 As GridViewCreateCompositeFilterDialogEventArgs)
        radGridView1_CreateCompositeFilterDialog(e2, CType(sender, RadItem).AccessibleName, column)
                                           End Sub
 
    End Sub

How can I load the window with the appropriate filters prefilled to the form?

 

It looks like we're on Telerik version 2017.3.1017.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 09 Mar 2018
1 answer
282 views
How can I hide a floating document window? Right now it seems as though if you right-click, it gives you the option to be able to hide the window, but when you click on it, it doesn't really hide it, it closes it instead. When I switch the closeAction propery to hide, it seems like you can hide the window now. But when it's on the default behavior for closeaction which is closeanddispose, it just closes it. Is that what it's supposed to do? Is there a way to close the window when I hit the x and if I hide it, it actually hides it? I noticed that if I disable the option to hide (which AutoHide is already disabled), it disables the x in the corner of the window too. 
Hristo
Telerik team
 answered on 09 Mar 2018
2 answers
232 views

     Hi,

when I manually resize columns on PivotGrid and then run Export to Excel (or PDF) - row descriptor columns (Day, Aggregates) are same size in Excel, but aggregates columns somehow resized. Is it by design or there is a way to export row descriptor columns width as well?

Alex

 

Alex Dybenko
Top achievements
Rank 2
 answered on 09 Mar 2018
6 answers
120 views
Hi, I've been trying to record action of ToolWindow and Document Window in codeUI testing tool, and I am not able to get Id or Name for DockTabStrip and my tests are being failed. Also not able to select Close and AutoHide buttons on DockTabStrip  when I apply cross hair on them. Is there any way I can access these when windows are Docked in?
Megamind
Top achievements
Rank 1
 answered on 09 Mar 2018
1 answer
87 views

Hello,

Exporting a PivotGrid with RowHeadersLayout set to "Compact" results in an invalid XLS file.

The first column has an negative width. Which results in an Excel error while opening the xls file.

Christian

XML-FEHLER in Tabelle
GRUND:  Ungültiger Wert
DATEI:  C:\Users\...\Test.xls
GRUPPE: Table
TAG:    Column
ATTRIBUT:   Width
WERT:   -20
Hristo
Telerik team
 answered on 08 Mar 2018
3 answers
606 views

Hi,

I'm trying to change the text of the checked item of a RadCheckedDropDownList by using the TextBlockFormatting event.

TokenizedTextBlockElement token = e.TextBlock as TokenizedTextBlockElement;
if (token != null && token.Item.Value != null)
{
    token.DrawText = false;
    token.ContentElement.Text = string.Format("{0}", ((Telerik.WinControls.UI.RadListDataItem)token.Item.Value).Value);
}

 

this works, the items are displayed correctly. However, if there are multiple checked items and one item becomes unchecked (by using the X) the complete selection is cleared. The Datasource is a Dictionary<dynamic, string>(). Without the formatting everything works fine.

I've tried CreateTextBlock without any luck. I've seen there is some code with a custom TokenizedTextBlockElement, but I hope there is a simpler way?!
There should be a XXXMember property like the DescriptionTextMember, AutoCompleteDisplayMember otherwise there is nothing about RAD in your RAD components ... last time i checked RAD was short for Rapid Application Development and not investing 2+ hours for such a simple task. And NO I don't want to format the items in the dropdown since I have some dropdowns with >2000 Items and it becomes very slow if I add the formatting.

 

 

 

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 08 Mar 2018
3 answers
63 views

     I need to capture the row the user is adding so I can send it (or others) back to the database for insert.  I have not tried the inline editing yet.
I'm using WinForms.

I've tried the following to capture when the user is done adding (Enter Key) with zero results:
void radGridViewActiveSchedules_UserAddedRow(object sender, GridViewRowEventArgs e)
void radGridViewActiveSchedules_DefaultValuesNeeded(object sender, GridViewRowEventArgs e)
void radGridViewActiveSchedules_CellBeginEdit(object sender, GridViewCellCancelEventHandler e)

What am I missing

Dimitar
Telerik team
 answered on 08 Mar 2018
3 answers
136 views

why is the grid coloring wrong cells when i group the data? it works until you do a group by.

 

Imports System.ComponentModel
Imports Telerik.WinControls
Imports Telerik.WinControls.UI

Public Class Form1
    Private _list As New BindingList(Of data)
    Private _groups() As String = {"one", "two", "three", "four"}
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        GenData()
        grid.DataSource = _list

    End Sub

    Private Sub GenData()
        For i = 0 To 1000
            _list.Add(New data() With {.Foo = "foo" + i.ToString,
                                     .Bar = _groups(i Mod 4),
                                     .Bye = "bye" + i.ToString,
                                     .Hi = "hi" + i.ToString,
                                     .Index = i})
        Next
    End Sub

    Private Sub grid_CellFormatting(sender As Object, e As CellFormattingEventArgs) Handles grid.CellFormatting
        If TypeOf e.Row Is GridViewDataRowInfo Then
            If e.CellElement.ColumnInfo.Name.ToLower = "foo" Then
                Dim b As data = CType(e.Row.DataBoundItem, data)
                If b.Index Mod 2 > 0 Then
                    e.CellElement.DrawFill = True
                    e.CellElement.BackColor = Color.Pink
                    Console.WriteLine(e.CellElement.ColumnInfo.Name + " going pink - " + e.CellElement.RowIndex.ToString)
                    e.CellElement.GradientStyle = GradientStyles.Linear
                Else
                    e.CellElement.DrawFill = False
                    e.CellElement.BackColor = Color.White
                    Console.WriteLine(e.CellElement.ColumnInfo.Name + " going white - " + e.CellElement.RowIndex.ToString)
                    e.CellElement.GradientStyle = GradientStyles.Solid
                End If
            End If
        End If
    End Sub

End Class

Public Class data

    Public Property Foo As String = ""
    Public Property Bar As String = ""
    Public Property Hi As String = ""
    Public Property Bye As String = ""
    Public Property Index As Integer = -1
End Class

dd
Top achievements
Rank 1
 answered on 06 Mar 2018
2 answers
499 views
I have a set of data (4000) items that appear in a RadGridView.  The goal is for the user to select items from this GV to save.  When the form re-loads, I need the selected items to automatically show as selected.  
I have that column set as GridViewCheckBoxColumn.

I am looping through the DataClass to match the information in which would determine if the record (row) would be selected.

Since I'm already looping through the data, I dont want to have to loop through the GV each time to find the Cell in which to select.  I was hoping there would be a way to Search or FindBy XXX.

I've yet to find any information on how to do this and it seems like something that most people would use....  What am I missing?

Brandy
Top achievements
Rank 1
 answered on 06 Mar 2018
7 answers
1.1K+ views

I am using Version 2016.2.608.20 of WinControls.UI.  

 

WHERE IS PERFORMCLICK EVENT?

My client is very particular that they do not want anyone hand-typing a date into a control, so I need the date part of the DateTimePicker to be read-only.  Unfortunately, all attempts to do this do not work, and it appears that is not supported.  My workaround is a standard LABEL control placed OVER the date area of the DateTimePicker, with a painted border.  But the client wants to be able to CLICK on that now and have the calendar appear.

I considered using a standard RadButton and RadCalendar, but then I need to do a lot of extra work to make it extend beyond the modal dialog form bounds, etc.  I am hoping there is an easier way to just do a built-in PERFORMCLICK, if only I can find where it's hidden.

 

DISABLE SUNDAYS ON THE CALENDAR

I found other answers to this question, and it certainly makes the Sunday dates APPEAR disabled, but they can still click on them, and the date changes.  I am handling in the CLOSED event, adjusting the date accordingly to the next Monday... but it would be better if the Sundays actually stayed disabled / un-clickable.

 

HIDE THE CLEAR BUTTON

Minor issue, I can show the footer and disable the clear button... but is there any way to completely remove it?  (They like having the [TODAY] button in the footer.  This is minor... they can live with a disabled button... but if there's an easy way to hide it, how?

 

Thanks for your help!

 

Here is my code:

/// PART ONE - WHERE IS THE PERFORMCLICK EVENT?
 
private void MyLabel_MouseClick(object sender, MouseEventArgs e)
{
     // Attempts to locate the PerformClick event...
 
     MyRadDateTimePicker.DateTimePickerElement.PerformClick();
     MyRadDateTimePicker.DateTimePickerElement.ArrowButton.PerformClick();
 
     foreach (Telerik.WinControls.RadElement _Element in
          MyRadDateTimePicker.DateTimePickerElement.ArrowButton.Children)
                _Element.PerformClick();
 
     foreach (Telerik.WinControls.RadElement _Element in
          MyRadDateTimePicker.DateTimePickerElement.Calendar.CalendarElement.Children)
                _Element.PerformClick();
}
 
 
// PART TWO - HOW TO DISABLE SUNDAYS IN CALENDAR
 
private void MyRadDateTimePicker_Opened(object sender, EventArgs e)
{
     MyRadDateTimePicker.DateTimePickerElement.Value = this.SelectedDate;
             
     RadCalendar _Calendar = MyRadDateTimePicker.DateTimePickerElement.Calendar;
     CalendarTableElement _Table
        = (CalendarTableElement)_Calendar.CalendarElement.CalendarVisualElement.Children[0].Children[1];
 
     foreach (CalendarCellElement _Cell in _Table.Children)
     {
         if (_Cell.Date.DayOfWeek == DayOfWeek.Sunday)
         {
             _Cell.Enabled = false;   // Disables, but still leaves it clickable
         }
     }
     _Calendar.ClearButton.Enabled = false// Would actually prefer to HIDE this!
     _Calendar.ShowFooter = true;
}
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 06 Mar 2018
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?