Telerik Forums
UI for WinForms Forum
6 answers
500 views
Hi,
I am using check box column to select row.
In fact when the check box is selected, I am storing the DataBondItem of checked row in an Arraylist.

The constraint here is, at a time only one check box has to be checked.
When the next row is checked. The privious check box should be unchecked.

The above is the total functionality.

I am using, BeginEdit and ActiveEditorValuechanged event to perform the above functionality.

The problem here is I am getting 'Object Reference Error' once in a while.

Can anybody suggest better way to obtain the above functionality ?

Current Code for reference :

 void radGrid_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
        {
            currentRowIndex = e.RowIndex;
            CurrentRowDataItem = this.radGrid.Rows[e.RowIndex].DataBoundItem;

            try
            {
                CurrentRowDataItem = this.radGrid.Rows[e.RowIndex].DataBoundItem;
                if (radGrid.Columns[e.ColumnIndex] is GridViewCheckBoxColumn)
                {
                    //When the editor is clicked properly
                    if (radGrid.ActiveEditor != null && radGrid.ActiveEditor.Value != null)
                    {
                        //create handler for active Editor
                        radGrid.ActiveEditor.ValueChanged += new EventHandler(ActiveEditor_ValueChanged);
                    }
                }
            }
            catch { }
        }

        void ActiveEditor_ValueChanged(object sender, EventArgs e)
        {
            //Only when the value is not null
            if (radGrid.ActiveEditor != null && radGrid.ActiveEditor.Value != null)
            {
                //remove the handler, because next time when the editor is clicked new handler wil be created
                radGrid.ActiveEditor.ValueChanged -= new EventHandler(ActiveEditor_ValueChanged);
                try
                {
                    //Here check the any row's check box selected in the Grid or not.
                    if (this.selectedRows != null && radGrid.ActiveEditor != null)
                    {
                        //current data item
                        object item = radGrid.CurrentRow.DataBoundItem;

                        if (radGrid.ActiveEditor.Value.ToString().ToLower() == "true")
                        {
                            this.selectedRows.Clear();
                            this.selectedRows.Add(item);

                            if (PreviousRowDataItem == null || previousCheck == -1)
                            {
                                //previousCheck = currentRowIndex;
                                PreviousRowDataItem = this.radGrid.CurrentRow.DataBoundItem;
                            }
                            
                            //set current index of previously selected row. It has to be checked and set because while sorting index may change
                            previousCheck = GetActualCheck(PreviousRowDataItem);

                            //Uncheck the previously selected
                            if (previousCheck != -1)
                            {
                                //set false if its true
                                if (radGrid.Rows[previousCheck].Cells[0].Value.ToString().ToLower() == "true")
                                {
                                    radGrid.Rows[previousCheck].Cells[0].Value = Boolean.FalseString;
                                }
                            }
                            //change the previous rowdata to current dataitem
                            if (currentRowIndex != -1)
                            {
                                PreviousRowDataItem = this.radGrid.CurrentRow.DataBoundItem;
                            }

                            if (OnSelectionChange != null)
                            {
                                OnSelectionChange();
                            }
                        }
                        //if uncheck clear the selected rows
                        else
                        {
                            this.selectedRows.Clear();
                        }

                        //if the Edit is finished, have to call this Default function otherwise the edit should not be commited
                        bool b = radGrid.EndEdit();
                    }
                }
                catch (Exception ex)
                {
                    Nexus.UI.BaseMdiParent.RaiseException(this, ex);
                }
            }
        }






Vassil Petev
Telerik team
 answered on 25 Aug 2009
1 answer
179 views
Telerik has by far the best HTML editor on the market for ASP and as was noted by Telerik, its one of the best selling products that Telerik has. This begs the question - why is there not something similar provided by Telerik for WinForms? We are having to look at other companies to provide that functionality and the ones that are rich enough are not compatible in look and feel with Telerik. Tools like TXTextControl are very rich, but it would be good to see this kind of support in the Telerik suite to complete the offering - its a bit of a gaping hole.

Also, while the basic HTML-Like support is useful in things like the grid, it would be even more useful with just a few more formatting features such as Background-Color (so you could highlight a section of the text with a yellow background for example) or strikethrough (so you could show edits where a section of text was deleted). We are trying to mirror our web product which the Telerik Grid allows us to do and again are having to resort to third party alternatives.

Alternatively Rich Text would be an option in either case - the key is to be able to display the data with a few more options.

Are there any plans for either?
Vassil Petev
Telerik team
 answered on 25 Aug 2009
2 answers
218 views
Hello,

I want to disable to modify the checkBox in the gridView. I make AllowEditRow à false but the user can always modify the checkBox.

Thanks in advance.
Boryana
Telerik team
 answered on 24 Aug 2009
2 answers
137 views
Hello Telerik,

Does RadGrid has a in-built pagination functionality? 
can i get some idea about implementing the pagination functionality for RadGridView

Thanks
Kranthi
Nick
Telerik team
 answered on 24 Aug 2009
1 answer
625 views
hi all
i use radMDI form and show a radchild form
in radchild form i use a rad grid
i want rad grid clicked will show a dialog form and when the dialog form close will refresh gird in parent form
anybody help me
thanks
Deyan
Telerik team
 answered on 24 Aug 2009
1 answer
192 views
I'm trying to highlight my group rows in a grid based on their aggregate values. For example I have values for Max and Current, and depending on the percentage of values I would like to highlight the group header yellow/red/violet/green as appropriate. The attached code soomewhat works except it highlights the entire grid green, any help you can provide. (This is in the GroupSumaryEvaluate event.

            AggregateCollection coll = e.Group.Aggregates; 
            double max = 0, current = 0; 
            foreach (Aggregate agg in coll) 
            { 
                switch (agg.FieldName) 
                { 
                    case "max"
                        max += Convert.ToDouble(agg.Value.ToString()); 
                        break
                    case "current"
                        current += Convert.ToDouble(agg.Value.ToString()); 
                        break
                } 
            } 
            double percentage = 0; 
            if (max == 0 && current == 0) 
            { 
                percentage = 0; 
            } 
            else 
            { 
                if (max == 0 && current > 0) 
                { 
                    percentage = 1.1; 
                } 
                else 
                { 
                    percentage = current / max; 
                } 
            } 
            if (percentage > 0) 
            { 
e.Group.HeaderRow.GridViewInfo.GridViewElement.BackColor = Color.LightGreen;
            } 
            if (percentage >= .6) // Indicate middle tier (yellow) 
            { 
                e.Group.HeaderRow.GridViewInfo.GridViewElement.BackColor = Color.Yellow; 
            } 
            if (percentage >= .8) // Indicate upper tier (red) 
            { 
                e.Group.HeaderRow.GridViewInfo.GridViewElement.BackColor = Color.Red; 
            } 
            if (percentage > 1.0) // Indicate overbooked (violet) 
            { 
                e.Group.HeaderRow.GridViewInfo.GridViewElement.BackColor = Color.Violet; 
            } 

Deyan
Telerik team
 answered on 24 Aug 2009
3 answers
184 views
Hi, I am trying to set Focus on the GridView Filtering box when F2 Key is pressed.

Any idea ?

regards
Nick
Telerik team
 answered on 24 Aug 2009
1 answer
172 views
when i click a row in grid, i want to show dialog to addnew or edit form.
how i do? please help me
sorry i am newbie
thanks all
Victor
Telerik team
 answered on 21 Aug 2009
1 answer
119 views
Hi

Please look on this URL (http://65.57.255.33/GridViewWithHeader.JPG)
I need to group only column header like this. I am Rad Control Win Form (Q2 2009).
Please help me.

Regards
Atul Kumar Srivastav
Nick
Telerik team
 answered on 21 Aug 2009
1 answer
138 views

I can set the parent TableHeaderHeight for a RadGridView no problem...

((GridTableElement)this.radGridView1.GridElement).TableHeaderHeight = 20;

However I need to set the Header height on the related GridViewTemplate.
How can this be done programmatically?





Victor
Telerik team
 answered on 21 Aug 2009
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
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?