Telerik Forums
UI for WinForms Forum
2 answers
347 views
Hi, i want to know, if user can see the item at specifued position of ListView.
Currently i am doing like that:

bool isItemVisible(MyBusinessLogicClass c)
{
  for (int y = listView.Height; y > 10; y -= 10)
  {
     var result = listView.ElementTree.GetElementAtPoint(new Point(5, y),
            x => (x is SimpleListViewVisualItem) && ((SimpleListViewVisualItem)x).Data.DataBoundItem == c);
                 
             if (result != null)
                    return true;
    }
 
     return false;
 }


Is there any other "right" way having such ability?
Thanks!
Igor
Top achievements
Rank 2
 answered on 29 Jan 2014
1 answer
83 views
Hi,

I want to add (create and add to my datasource) multiple rows to my grid based on validating a field in the 'add new row' row.
At present, when I do this (as described below) it leaves me with the row being added. I would like to cancel the added row. In doing this I have been wondering if I am going about it all incorrectly, however:

I am unsure if I should perform some other function that captures the Add New Row functionality, if I should be doing what I'm doing (validating on CellValidating and adding the new rows) or using CellEndEdit or some other function to perform the load and cancelling the original edit.

In the grid (ProductCode, Operation, Quantity, Hours, and some resultant fields), I am trying to allow the user to enter in a specific sub-product code - to enter in one line, or to enter in a parent product code which will pre-populate a bunch of rows (for all the children meeting the criteria).

It currently is working as I want, barring the cancelEdit usage after adding in bulk. I'm not sure how to accomplish this (or do it better). Any advice would be really appreciated!

Here is basically what I currently have:
Private Sub rgvProducts_CellValidating(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CellValidatingEventArgs) Handles rgvProducts.CellValidating
        Dim col As GridViewDataColumn = e.Column
        Dim validateMessage As String = ""
        lblMsg.Text = ""
 
        If quitValidating Then
            Return
        End If
 
        If e.Row IsNot Nothing Then
            'if new row and field entered is "ProductCode"
            If e.Row.GetType Is GetType(GridViewNewRowInfo) AndAlso col.FieldName = "ProductCode" Then
                If String.IsNullOrWhiteSpace(e.Value) Then
                    'show validation message: cannot be blank
                    Return
                End If
 
                Dim coreProducts As DataTable
                Dim lp As LabourProduct
                Dim resultsMessage As String = ""
 
                'Check if ProductCode value is valid against CoreProduct mapping
                If ApplicationFunctions.fieldValidate("CoreProductCode", e.Value) Then
                    coreProducts = Labour.retrieveCoreProductRows("", e.Value, cl.Operation) 'retrieve set of CoreProduct rows filtered by Operation
                    If coreProducts.Rows.Count = 0 Then
                        'show validation message: No CoreProduct items found
                        Return
                    ElseIf coreProducts.Rows.Count = 1 Then 'if single row returned, allow editing in-line
                        rgvProducts.CurrentRow.Cells("ProductCode").Value = coreProducts.Rows(0)("CoreProductCode")
                        rgvProducts.CurrentRow.Cells("Operation").Value = coreProducts.Rows(0)("Operation")
                        rgvProducts.CurrentRow.Cells("ActualQuantity").Value = coreProducts.Rows(0)("StandardQuantity")
                        rgvProducts.CurrentRow.Cells("StandardQuantity").Value = coreProducts.Rows(0)("StandardQuantity")
                        rgvProducts.CurrentRow.Cells("StandardHours").Value = coreProducts.Rows(0)("StandardHours")
                        rgvProducts.CurrentRow.Cells("EarnedHours").Value = coreProducts.Rows(0)("StandardHours")
                        rgvProducts.CurrentRow.Cells("Description").Value = coreProducts.Rows(0)("ProductDescription")
                        Return
                    Else
                        resultsMessage = ProcessCoreProductDataTable(coreProducts) 'This adds multiple rows to grid and saves the objects
                        If Not resultsMessage = "Success" Then
                            'show validation message: Error saving
                            Return
                        Else 'Here trying to rebind the data source and cancel the edit
                            ApplicationFunctions.showMsg(lblMsg, resultsMessage, ApplicationFunctions.AlertModes.Positive)
                            rgvProducts.DataSource = ""
                            rgvProducts.DataSource = cl.LabourProductList
                            rgvProducts.CancelEdit()
                        End If
                    End If
                Else 'if not matched against the CoreProduct, then trying to match against Product parent
                    coreProducts = Labour.retrieveCoreProductRows(e.Value, "", cl.Operation)
                    If coreProducts.Rows.Count > 0 Then 'if rows returned then add them
                        resultsMessage = ProcessCoreProductDataTable(coreProducts)
                        If Not resultsMessage = "Success" Then
                            ApplicationFunctions.showMsg(lblMsg, resultsMessage, ApplicationFunctions.AlertModes.Negative)
                            e.Row.ErrorText = resultsMessage
                            e.Cancel = True
                            Return
                        Else
                            ApplicationFunctions.showMsg(lblMsg, resultsMessage, ApplicationFunctions.AlertModes.Positive)
                            rgvProducts.DataSource = ""
                            rgvProducts.DataSource = cl.LabourProductList
                            rgvProducts.CancelEdit()
                        End If
                    'else show validation message: product code entered invalid
                    End If
                End If
            ElseIf (e.Row.GetType Is GetType(GridViewDataRowInfo) Or e.Row.GetType Is GetType(GridViewNewRowInfo)) And Not col Is Nothing Then 'only inline editing for any already entered rows
                validateMessage = validate(col.FieldName, e.Value)
                If validateMessage <> String.Empty Then ApplicationFunctions.showMsg(lblMsg, validateMessage, ApplicationFunctions.AlertModes.Negative)
            End If
        End If
    End Sub
     
     
    'add items in bulk and save
    Private Function ProcessCoreProductDataTable(ByRef coreProducts As DataTable) As String
        Dim saveMessage As String = ""
        Dim lp As LabourProduct
        For Each cp As DataRow In coreProducts.Rows
            lp = New LabourProduct()
            lp.LabourID = cl.LabourID
            lp.ProductCode = cp("CoreProductCode")
            lp.CoreBoxNumber = lp.ProductCode.Substring(lp.ProductCode.LastIndexOf("_C"))
            lp.Operation = cp("Operation")
            lp.ActualQuantity = cp("StandardQuantity")
            lp.StandardQuantity = cp("StandardQuantity")
            lp.StandardHours = cp("StandardHours")
            lp.EarnedHours = cp("StandardHours")
            lp.Description = cp("ProductDescription")
            If Not lp.save(saveMessage) Then
                Return saveMessage
            Else
                cl.LabourProductList.Add(lp)
            End If
        Next
        Return saveMessage
    End Function

George
Telerik team
 answered on 29 Jan 2014
2 answers
283 views
Using version 2013.3.1127.40

Hi, i have a huge memory leak in the scheduler and am trying to figure out how to fix it.
I have a scheduler that's grouped by resources.  It's a medical application, the scheduler shows appointments.

On each appointment, i have heavily customized it with stack panels and buttons/labels etc to show different statuses and allow users to interact with it.  I do this in the schMain_AppointmentFormatting event.

The data is bound via a bindinglist of a custom objects i created.

The scheduler also refreshes itself on a 1 minute timer to get changes/new appts etc.
the refresh method clears the bindinglist and repopulates it.
I do this between a 
schMain.Appointments.BeginUpdate();
and
schMain.Appointments.EndUpdate();
schMain.SchedulerElement.Refresh();

eventually after about 35 refreshes the app locks up with an OOM.  There's nothing open in the app other than the scheduler which is just sitting there refreshing itself.  
I put a memory profiler on it and it appears all the custom stacklayoutpanel and labels etc i put on the appts aren't being cleaned up.  If there are 40 apps on the scheduler, after 30 refreshes i end up with thousands of labels still in memory,  10's of thousands of radpropertyvalue etc.

What's the correct way to dispose of my custom stuff when it gets redrawn?
I attached a shot of ants profiler with some of the leaked data if it helps.
Thanks!



Ivan Todorov
Telerik team
 answered on 29 Jan 2014
7 answers
428 views
Does the Telerik Panel control have built-in support for use as a collapsible panel?  Any code examples if it does?
George
Telerik team
 answered on 28 Jan 2014
1 answer
151 views
I make many to many relationship in erd diagram in sql server 2005 between car and driver as following
car table
driver table
car_driver table.
I need to make fleet management program. When I make forms in windows form are i make
 car form
driver form
car_driver form
When i insert data are creating three forms each form insert to related tables
car table car form
driver table driver form
car_driver table car_driver form
George
Telerik team
 answered on 27 Jan 2014
0 answers
243 views
Hello,

I did a search and added the code below to scroll to the selected row and works. But when I move my mouse over the grid it automatically scrolls to the top of the grid. The row is still selected but why does it do this? Can I do anything about it to stop doing this?

Below is my code. Thanks!
Warren

'Bind Grid Here
            Dim ConnString7 As String = "Server=xxxxx;Database=xxxxx;User Id=xxxxx;Password=xxxxx;"
            Dim SQLConn As New SqlConnection()
            Dim SQLCmd As New SqlCommand()
            SQLCmd.Connection = SQLConn
            SQLCmd.CommandType = CommandType.Text
            SQLCmd.CommandText = "Select SpecialInst, OrderID FROM SPP_SpecialInst ORDER BY OrderID"
            SQLConn.ConnectionString = ConnString7
            SQLConn.Open()
            Dim reader As SqlDataReader
            reader = SQLCmd.ExecuteReader()
            gvSpecialInst.MasterTemplate.LoadFrom(reader)
            reader.Close()
            SQLConn.Close()
'Settings for selecting a row and the scroll options
gvSpecialInst.AutoScroll = True
gvSpecialInst.Rows(5).IsSelected =
True
gvSpecialInst.Rows(5).IsCurrent = True
gvSpecialInst.TableElement.ScrollToRow(gvSpecialInst.Rows(5))
 





Warren
Top achievements
Rank 1
 asked on 25 Jan 2014
5 answers
607 views
I have multiple horizontal RadListViews on a user control. These RadListViews have ListViewDataItems dynamically added to them. When all the items have been added, by default the RadListView has scrolled to the end, ie. all the way to the right.

How do I prevent this or set the scroll bar to the start?

Andrey
Top achievements
Rank 1
 answered on 24 Jan 2014
1 answer
219 views
Hello,
I've been asked to integrate an exsisting component (a library the sends events about financial transaction) on a winfor application.
That library sends as an event a List of Item that are bound to a radgridcolumn via bindinglist.

Each time an event is fired I got this in my code

bindingSource.DataSource = tmrC.ViewableData;

I wish to keep the context menu open even if sometime the refresh rate of the data is quite rapid (1 sec or less) but as the Bindingsource is refreshed I got the contextmenu closed.

I don't know under winform which is the best approach, can I have a concurrent queue to put the data from the list and then (in some way) to update the grid?
 Or what?

Thanks in advance


George
Telerik team
 answered on 24 Jan 2014
1 answer
107 views

Hi Team,


   I want design the grid as per the attached screenshot. The infragistics grid have grid column show vertically. Please give any samples for this.



Thanks & Regards

Suresh

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 24 Jan 2014
2 answers
161 views
Hello Telerik support,

I hav a grid which binds an (Telerik Open Access) object source. Some columns have Expression Editors:

//  Attaching the datasource
radGridView2.DataSource = _activeBatch.LigdagenKlinischGefactureerds.OrderBy(c => c.RowNumber);
 
 
// Expression column definition:
GridViewTextBoxColumn b = new GridViewTextBoxColumn("B")
            {
                HeaderText = "B",
                EnableExpressionEditor = true,               
                Expression = @"IIF(ISNULL(PreviousNo,"""")<>No,""nieuw"",null)"
            };

When saving the datasource something strange happens. Just before do a SaveChanges I check the values of a specific row which should contain changed (evaluated) values:

radGridView2.Row[x].Cell["B"].Value = "nieuw", this is as expected for the evaluation of row X
(radGridView2.Row[x].DataBoundItem as MyBoundObject).B = null (???)


Additionally I have another question: If my datasource contains a value, the expression should not be evaluated. Is this possible? (maybe on a specific cell event?)

Kind regards,
Raoul

George
Telerik team
 answered on 23 Jan 2014
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?