Telerik Forums
UI for WinForms Forum
2 answers
119 views
Hi there,

I have just upgraded my application to the latest version and discovered a weird bug with the GridView_CellFormatting event.

The previous version was trying to format the colors of the current cell depending on the value of another cell in the same row.

To simplify this behaviour, we can just look at 3 columns in a grid. Column 1: ID, Column 2: Name, Column 3: Status

If the status is True, Column 1's colour would be Blue and if the status is False, then column 1's colour would be Red.

in the previous version, the code was working fine..but with the new version, it seems that the Name column would also be affected.

and everytime the grid is refreshed through some random action e.g. moving of scrollbars, the name column's forecolor would change randomly..to either Red or Blue when those colours should only be affecting column 1.

private void gvDocuments_CellFormatting(object sender, CellFormattingEventArgs e)
        {
            
                if (e.CellElement.RowIndex >= 0)
                {
                    GridViewColumn col = e.CellElement.ColumnInfo as GridViewColumn;
                    GridViewRowInfo row = e.CellElement.RowInfo;
                     
                    string fieldName = col.Name;
                    if (fieldName == "Id")
                    {
                        if (row.Cells["Status"].Value.ToString() == "T")
                        {
 
                            e.CellElement.ForeColor = Color.Blue;
                            e.CellElement.Font = font;
                        }
                        else
                        {
                            e.CellElement.ForeColor = Color.Red;
                            e.CellElement.Font = font;
                        }
                    }    
                }
          }

P.s. I think The #2 example in http://www.telerik.com/help/winforms/formatting_cells.html is wrong... RowInfo.Cells[ColumnName] does not contain the CellElement property.

e.CellElement.RowInfo.Cells["column1"].CellElement.ForeColor
Jack
Telerik team
 answered on 23 Sep 2010
1 answer
133 views
Dear Sir,

I wanted to export gridview data into .pdf file. I gone through kb and it tells that you need to create an object of ExportToPDF. Now I cannot find the specified class in the Telerik.WinControls.UI.Export namespace. There is only one class in the given namespace i.e. ExportToExcelML!

I am using Telrik Controls for WinForms Q1 2010.

Thanks,
Divyesh
Martin Vasilev
Telerik team
 answered on 23 Sep 2010
8 answers
213 views
The title of the thread says it all:

Me.RadGridView.Rows().Cells().Style.BackColor = Color.Yellow

Me.RadGridView.Rows().Cells().Style.BackColor = Color.Yellow

Me.RadGridView.Rows().Cells().Style.BackColor = Color.Yellow

Me.RadGridView.Rows().Cells().Style.BackColor = Color.Yellow

Me.RadGridView.Rows().Cells().Style.DrawFill = True

I understand that the cell element is gone but this code worked last build using the CellElement but not with the new Style object. I would assume there is a way to change the back color of a cell at run-time. Please give me the correct way so my code will work. Thank you.


OK More Info.....

Me.RadGridView.Rows().Cells().Style.ForeColor = Color.Yellow

this works!!! soooo....just maybe this is something you need to fix with backcolor.. :-)

I find it hard to believe there is no current way with the latest version to set the backcolor of cells at run-time, so any code that works I'll take at this point.

Eric



 

 

 

 

Martin Vasilev
Telerik team
 answered on 23 Sep 2010
8 answers
207 views
hi,
When I edit with GridView when the wizard does not update table
please help..
thankyou
Alexander
Telerik team
 answered on 23 Sep 2010
7 answers
431 views
I'm working on an inventory form and one of the (optional) fields is ReplacementDate. Obviously, for equipment that is still in service, there won't be a value for the ReplacementDate. Is there a way for either the RadMaskedTextBox (with a DateTime mask) or RadDateTime picker to handle a nullable DateTime natively, or do I have to use a numeric mask and handle the Validating event?
Elliott
Top achievements
Rank 2
 answered on 22 Sep 2010
1 answer
124 views
Hi,

i've just tested a bit and scrolled through one of my several gridviews that i am using in my application and...whooops...
i've got this error message here:

"Object reference not set to an instance of an object."
And this error occured in Telerik.Wincontrols.UI.

Attached you can find the stack trace:

"   bei Telerik.WinControls.UI.ItemScroller`1.HideToolTip()\r\n   bei Telerik.WinControls.UI.ItemScroller`1.UpdateOnScroll(ScrollEventArgs e)\r\n   bei Telerik.WinControls.UI.ItemScroller`1.scrollbar_Scroll(Object sender, ScrollEventArgs e)\r\n   bei Telerik.WinControls.UI.RadScrollBarElement.OnScroll(ScrollEventArgs args)\r\n   bei Telerik.WinControls.UI.RadScrollBarElement.CallOnScroll(ScrollEventType scrollType, Int32 oldValue, Int32 newValue)\r\n   bei Telerik.WinControls.UI.RadScrollBarElement.EndScroll(Int32 endValue)\r\n   bei Telerik.WinControls.UI.RadScrollBarElement.OnMouseUp(MouseEventArgs e)\r\n   bei Telerik.WinControls.RadElement.OnCLREventsRise(RoutedEventArgs args)\r\n   bei Telerik.WinControls.RadElement.OnBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   bei Telerik.WinControls.RadItem.OnBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   bei Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   bei Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   bei Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   bei Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   bei Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)\r\n   bei Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e)\r\n   bei Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)\r\n   bei Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)\r\n   bei Telerik.WinControls.UI.RadGridView.OnMouseUp(MouseEventArgs e)\r\n   bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n   bei System.Windows.Forms.Control.WndProc(Message& m)\r\n   bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)\r\n   bei Telerik.WinControls.RadControl.WndProc(Message& m)\r\n   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n   bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n   bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n   bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n   bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n   bei System.Windows.Forms.Application.Run(ApplicationContext context)\r\n   bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()\r\n   bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()\r\n   bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)\r\n   bei MediaCenter.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.\r\n   bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   bei System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)\r\n   bei System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)\r\n   bei System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()\r\n   bei System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)\r\n   bei System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)\r\n   bei System.Activator.CreateInstance(ActivationContext activationContext)\r\n   bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()\r\n   bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   bei System.Threading.ThreadHelper.ThreadStart()"

Is there a workaround for this particular problem?
Jack
Telerik team
 answered on 22 Sep 2010
7 answers
606 views
Hi,

I am showing comments in the grid .
now if comments are more than 20 lines i want that scroll bars be displayed inside the textbox cell of the gridview.

I do not want to use auto rowsize or word wrap. I there a way to show a scroll bar inside the text box cell

thanks,
Nikolay
Telerik team
 answered on 22 Sep 2010
1 answer
118 views
Hi all,

Iam using Radgrid in my application which contains Grid view checkbox column and it is added through design.I have set the property as Fullrowselect for checkbox column .I will select the rows through checkbox and I need to get the count of selected rows in the grid when multiple rows are selected.Can anyone provide me the codesnipett please.

Thanks
Prasad.
Jack
Telerik team
 answered on 22 Sep 2010
8 answers
762 views
I would like to have the grid automatically add a new row when the user presses "Tab" from the last cell in the last row of the grid.

This works if the last row of the grid is an "existing" row (meaning the row was present when the grid DataSource was set). However, it does not work if the user is already entering a "new" row.

For example:

1. Grid is displayed with 2 existing rows.
2. Focus is given to the top-left cell in the grid.
3. User presses "Tab" to navigate across the first row (editing data as needed).
4. User presses "Tab" while in the last column of the first row and focus moves to first column of 2nd row (this is good).
5. User presses "Tab" to navigate across the 2nd row (editing data as needed).
6. User presses "Tab" while in the last column of the 2nd row and focus moves to the first column of a "new" 3rd row (this is good).
7. User presses "Tab" to navigate across the "new" 3rd row (editing data as needed).
8. User presses "Tab" while in the last column of the "new" 3rd row - but nothing happens.
9. User gets confused, can't figure out how to add more rows (this is bad).
10. User calls me (this is really, really bad!!)

Any ideas on how to make the grid keep adding more rows automatically?
Jack
Telerik team
 answered on 22 Sep 2010
3 answers
191 views
I have a GridView that has a child template and a relation. I can populate both without an problems at all. When I expand to view the childrows and click/double click one of them I need to open a secondary form that displays some additional data. In order to do that I need to be able to determine the properties of that childrow which was clicked. However, I keep getting the row in the  MasterTemplate... how do I go about this.
Alexander
Telerik team
 answered on 22 Sep 2010
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?