Telerik Forums
UI for WinForms Forum
2 answers
378 views
I have a large set of data with which server-side paging is implemented.  I need to requery the data source any time the GridView's filter is changed by the user.  The problem lies in the fact that rebinding the DataSource inside any of the FilterChanged, FilterChanging, or FilterExpressionChanged events of the grid causes a null reference exception at the application level.

To work around this, I have found the following code which will correctly refresh the data source after a filter change has been finalized.

private void TicketView_CellEndEdit(object sender, GridViewCellEventArgs e)
{
    if ((sender as GridViewEditManager).GridViewElement.CurrentCell is GridFilterCellElement)
    {
        RequeryGridData();
    }
}

While the data source now refreshed automatically on a text change, it still did not refresh on a filter type change (ie. "Contains" to "Does not contain").  I tried calling RequeryGridData() in the closed event of the filter popup menu as follows.

private void TicketView_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    if (e.ContextMenuProvider is GridFilterCellElement)
    {
        e.ContextMenu.DropDownClosed +=
        new RadPopupClosedEventHandler(FilterContextMenu_Closed);
    }
}
 
void FilterContextMenu_Closed(object sender, EventArgs e)
{
    RequeryGridData();
}

This still caused a null reference exception.  I wondered what would happen if I delayed the datasource refresh until after the close event had finished and found myself with this code.

private void TicketView_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    if (e.ContextMenuProvider is GridFilterCellElement)
    {
        e.ContextMenu.DropDownClosed +=
        new RadPopupClosedEventHandler(FilterContextMenu_Closed);
    }
}
 
void FilterContextMenu_Closed(object sender, EventArgs e)
{
    //HACK: Have to refresh grid contents, but MUST NOT do it from a filter changing event as
    //      updating the datasource while the filter change is finalized crashes the program
    System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
    timer.Interval = 1;
    timer.Tick += new EventHandler(FilterChangedTimer_Tick);
    timer.Start();
}
 
void FilterChangedTimer_Tick(object sender, EventArgs e)
{
    (sender as System.Windows.Forms.Timer).Dispose();
    RequeryGridData(); 
}

Which, as I suspected, works great.  No exceptions occurred.

My question is: Is there a cleaner way of detecting the filter change and performing a datasource change?  Perhaps this functionality is not the intended use of the GridView's filter controls, in which case I'll settle for the solution (read: hack) I've managed to come up with, but hopefully there is a better way to handle this.

Thank you for your time.
Chris Ward
Top achievements
Rank 1
 answered on 11 Jun 2012
0 answers
68 views
Dear Ivan Petrov

thanks a lot for your answer it was very useful, now I have an other problem, I want to change alignment to right, I searched and found a suggest, but it wasn't any useful for me, and I want to get color to get rectangle, but argb color's property is read only and I can't to do this and totally I want to change properties in the print for example : get page border, get alignment, get color, etc. but I can't do it.
would you can help me.
best regard.
Maryam
Maryam
Top achievements
Rank 1
 asked on 11 Jun 2012
2 answers
463 views
Hi
I used PropertyGrid . I defined item that is type of boolean and want to get value change and store this value in datatable 
i can't find property value in this event and don't know how to use GetValue(radProperty) .
How can do this ?
Atefeh
Top achievements
Rank 1
 answered on 11 Jun 2012
2 answers
132 views
Hi,
Using a radtreeview with an access db with my data in a recursiv datatable, I would like to go through each element of the radtreeview to retrieve the displaymember and do some additional processes. Something like:
foreach(.... )
{
Parent -> go through each child of it -> if there are grandchildren-> go through each grandchild of child...
get_the_displayname_and_print_it()
.... do whatever...
}
and so on.
Can someone give me some support in this issue?
Thanks
Karl

Karl
Top achievements
Rank 1
 answered on 10 Jun 2012
3 answers
454 views

 

 

Hi.
I used RadDropDownListEditor  in my gridview.when press tab Key and enter it,and start write with keyboard
i have a problem.but when enter this cell with Mouse I don't have any problem.
I used RadDropDownListEditor  in ver2011 and don't have any problem.
but now Use ver2012.this problem is exist.


private
void GrdCheck_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)

 

{

 

 

    if (GrdCheck.CurrentColumn is GridViewComboBoxColumn)

 

    {

 

 

        if (GrdCheck.CurrentColumn.Name.ToString() == "BankRef")

 

            {

 

 

            RadDropDownListEditor comboBoxEditor = this.GrdCheck.ActiveEditor as RadDropDownListEditor;

 

 

 

            if (comboBoxEditor != null)

 

            {

                comboBoxEditor.EditorElement.StretchVertically =

 

false;

 

                comboBoxEditor.DropDownStyle = Telerik.WinControls.

 

RadDropDownStyle.DropDownList;

 

                comboBoxEditor.DropDownSizingMode =

 

SizingMode.UpDownAndRightBottom;

 

            }
            }
    

 

}

 

}

 

 

 

private void GrdCheck_CellEditorInitialized(object sender, GridViewCellEventArgs e)

 

{

 

 

    if (GrdCheck.CurrentColumn.Name.ToString() == "BankRef")

 

    {

 

 

        RadDropDownListEditor cmb = GrdCheck.ActiveEditor as RadDropDownListEditor;

 

 

 

        if (cmb != null)

 

        {

            ((

 

RadDropDownListEditorElement)(cmb).EditorElement).DisplayMember = "Descr";

 

            ((

 

RadDropDownListEditorElement)(cmb).EditorElement).ValueMember = "Id";

 

 

            ((

 

RadDropDownListEditorElement)(cmb).EditorElement).DataSource =DtBankCheck;

 

            ((

 

RadDropDownListEditorElement)(cmb).EditorElement).SelectedIndex = -1;

 

            ((

 

RadDropDownListEditorElement)(cmb).EditorElement).ShowPopup();

 

        }

    }
}

Peter
Telerik team
 answered on 08 Jun 2012
4 answers
1.1K+ views
Hi:

I found a way to disable wimform's close button on codeproject

http://www.codeproject.com/KB/cs/DisableClose.aspx

but it's not working  on R.A.D form (Q1 2009 SP1)  with vista theme.

can you provide a way to disable close button of R.A.D form?

thanks.
Ivan Petrov
Telerik team
 answered on 08 Jun 2012
1 answer
191 views
I am using a Web Method to fill a telerik combobox that is in a user control. (see http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx ).  I would like to put the Web Method code in the code behind for the user control rather than the mainpage code.   

<telerik:RadComboBox ID="RadComboBox4" runat="server" Width="250px" Height="150px"
                EmptyMessage="Select a Company" EnableLoadOnDemand="true" ShowMoreResultsBox="true"
                EnableVirtualScrolling="true"
>
                
<WebServiceSettings Method="GetCompanyNames" Path="defaultcs.aspx" />
</telerik:RadComboBox>


So for the path, I would like to put: Path = "usercontrol1.ascx" rather than Path = "defaultcs.aspx", but it cannot find the web method.  Is it possible for a user control to call a web method that is in the code behind for the user control?

Ivana
Telerik team
 answered on 08 Jun 2012
2 answers
143 views
I am working on creating automated tests with CodedUI and I am having problems with the RadDropDownList. I can't verify the values that the RadDropDownList is set to. Whenever i try to verify the values CodedUI points to the a generic text box on the page. I am using version 2011.2.11.831. Even if I get a hold of the list the selected string value == null even when a value is selected.

I see that RadDropDownList is supports CodedUI so I wonder if I am doing something wrong or if there is a bug. Any help would be greatly appreciated. 
Peter
Telerik team
 answered on 08 Jun 2012
1 answer
393 views
Sorry for the stupid question, I can not understand what is the control to use for make the navigation bar in the main form of your examples... see the link

http://imageshack.us/photo/my-images/51/navigationbar.jpg/
Nikolay
Telerik team
 answered on 07 Jun 2012
1 answer
219 views
Good morning, I need to reload the radscheduler from the database, how I can do it? basically I need to reload as when you open for first time the form that contain the RadScheduler but without closing the form.
Thanks.
Ivan Todorov
Telerik team
 answered on 07 Jun 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
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?