Telerik Forums
UI for WinForms Forum
1 answer
123 views
Hello,

I'm using CellBeginEdit event on RadGridView to optionally cancel the edit depending on the contents on the cell. Some example code is below.

But what if the cell is edited is not in the top level hierarchy? I'm using a hierarchy gridview with relations. RowIndex cannot tell me this. How can I know this? I just want to access the DataBoundItem on the current editing cells row.

public static void CellBeginEdit_ReadonlyRows(object sender, Telerik.WinControls.UI.GridViewCellCancelEventArgs e) 
    if (e.RowIndex == -1) 
         return; 
 
    RadGridView gridView = sender as RadGridView; 
 
    if (gridView == null) 
         return; 
 
    MyEditableEntry groupItem = gridView.Rows[e.RowIndex].DataBoundItem as MyEditableEntry; 
 
    if (groupItem == null || !groupItem.IsEditable) 
         e.Cancel = true
    else 
         e.Cancel = false
 


Robert
Top achievements
Rank 1
 answered on 25 Aug 2009
1 answer
266 views
The example posted here

http://www.telerik.com/community/forums/winforms/ui-controls/drop-and-drag-between-two-listbox.aspx

only allows single listboxitem moves. If I set the mousedown event to be

 Private Sub lstMembers_MouseDown(ByVal sender As ObjectByVal e As System.Windows.Forms.MouseEventArgs) Handles lstMembers.MouseDown 
      Dim lstBox As RadListBox = sender 
      lstBox.DoDragDrop(lstBox.SelectedItems, DragDropEffects.Move) 
   End Sub 




The listbox does not select the proper values.

Is there a way you can drag multiple values?

Thanks

-Matt
Robert
Top achievements
Rank 1
 answered on 25 Aug 2009
6 answers
446 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
150 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
182 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
109 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
553 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
166 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
145 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
138 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
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)
Chart (obsolete as of Q1 2013)
Form
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
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
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
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
Barcode
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Licensing
Localization
TimePicker
ButtonTextBox
FontDropDownList
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?