Telerik Forums
UI for WinForms Forum
4 answers
249 views
Ok i am using Entity Framework to access my data, I have no problem adding a record or deleting a record. But when I want to update a record I cant figure out what events to capture.

I have tried adding a  RadGridView1_RowsChanged to the code and it works great for the update, but my problem occurs now that when I add a record to the grid RadGridView1_RowsChanged gets called before RadGridView1_UserAddedRow.

In fact the NotifyCollectionChangedAction.ItemChanged gets called before NotifyCollectionChangedAction.Add gets called
So as soon as I leave a cell in the row my itemchanged fires before the add and i get problems.

How can i idenitfy if row is being added instead of updated. I sue wish there was a UserUpdatedRow event

Any help is appreciated

Public Class ManageMemberType
    Public context As New MIMSModel.MIMSEntities
    Dim newMemType As MemType
    Dim updMemType As MemType
    Dim dmemtype As MemType
    Dim rtype As String
  
  
    Private Sub ManageCompanyType_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim query = (From m In context.MemTypes Select m).ToList
        RadGridView1.DataSource = query
  
    End Sub
  
      
  
  
  
  
    Private Sub RadGridView1_RowsChanged(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCollectionChangedEventArgs) Handles RadGridView1.RowsChanged
  
        If e.Action = Telerik.WinControls.Data.NotifyCollectionChangedAction.ItemChanged Then
            Dim updrow As GridViewDataRowInfo = CType(e.NewItems(0), GridViewDataRowInfo)
  
            updMemType = MemType.CreateMemType(updrow.Cells("Type").Value.ToString)
  
            updMemType.Desc = updrow.Cells("Desc").Value.ToString
  
  
            DataAccess.UpdateEntity(updMemType, "MemTypes")
  
        End If
  
  
            End Sub
  
  
  
  
  
  
    Private Sub RadGridView1_UserAddedRow(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewRowEventArgs) Handles RadGridView1.UserAddedRow
        newMemType = MemType.CreateMemType(e.Row.Cells.Item("Type").Value.ToString)
        newMemType.Desc = e.Row.Cells.Item("Desc").Value.ToString
        Try
            context.MemTypes.AddObject(newMemType)
            context.SaveChanges()
            MsgBox("record Added")
        Catch ex As UpdateException
            e.Row.Delete()
            MsgBox(String.Format("The object could not be added. Make sure that a Member type of '{0}' does not aleady exist.", newMemType.Type))
        End Try
  
  
    End Sub
  
  
    Private Sub RadGridView1_UserDeletingRow(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewRowCancelEventArgs) Handles RadGridView1.UserDeletingRow
        rtype = e.Rows(0).Cells(0).Value.ToString()
        Dim rcount = (From r In context.GetCompanyInfoes Where r.CompanyType = rtype Select r).Count
        If rcount > 0 Then
            MsgBox("There are  " + rcount.ToString + " companies assigned to this member type, You cannot delete this type")
        Else
            Try
                dmemtype = MemType.CreateMemType(rtype)
                DataAccess.DeleteEntity(dmemtype, "MemTypes")
            Catch ex As Exception
                MsgBox("There was a problem deleting the Member type of " + rtype + " Please notify IT")
            End Try
  
        End If
    End Sub
  
  
End Class
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 25 Jan 2011
1 answer
128 views
I got the new version Q3 2010 after I was using 2009 Q2
I uninstalled all 2009 files and installed the new Q3
Now, all my old applications that I developed using Telerik Controls are giving errors and I spend hours repairing references
is there any solutions?
Richard Slade
Top achievements
Rank 2
 answered on 25 Jan 2011
6 answers
155 views
Hello. I have been using Telerik for a while and i must say i am very impressed. There isn't almost anything that we can't do.
But this time i run into a problem, as i wanted to apply drag and drop in my radmenu and it does not have such implementation. Maybe i am missing something, but is there anyway to implement this?
Thanks in advance,
Bes regards, Rui Silva
Jack
Telerik team
 answered on 25 Jan 2011
2 answers
322 views
hi,
Can i create fade IN/Out effects on all controls available in a rad form.
Like i want a button to appear not at once but to fade in.
Controls don't have an opacity property so i cant loop through that.
Any other way using Telerik. 

Thank you!!!
Svett
Telerik team
 answered on 25 Jan 2011
3 answers
185 views
Hi,

Is it possible when exporting to excel to use the column's field name instead of the heading text?

In other words, we would like to use a more user friendly heading text for the columns in the grid but when exporting it should use the field name instead. The default behavior is to export using the column's heading text.

Thanks
Richard Slade
Top achievements
Rank 2
 answered on 25 Jan 2011
4 answers
818 views
Hi,
I am using PageView Control of view mode strip like Tab i want to hide some tabs which is PageviewPage in PageView ,
on check box click event,and also want to hide some tabs first time when page is load.Is there any way to do this.
Richard Slade
Top achievements
Rank 2
 answered on 25 Jan 2011
6 answers
722 views

Hi
My code to change the back color of all the selected cells is working fine but It can not change the border color of all the selected cells of the grid. What I am doing wrong?

Here is my code:

private void dtgCpr_ViewCellFormatting(object sender, CellFormattingEventArgs e)
        {
            e.CellElement.DrawBorder = true;
            if (e.CellElement.IsSelected)
            {
                e.CellElement.BorderColor = Color.Red;
                e.CellElement.BackColor = Color.SeaShell;
            }
        }

Thanks

Regards

Zerka
Top achievements
Rank 1
 answered on 25 Jan 2011
8 answers
297 views
hi there

I bind the bindinglist<T> to the gridview. when the every custom object's property value change very ofen ,the corresponding cell's value can change also.But it take too much CPU(around 60%).
I have a custom object inherit from INotifyPropertyChanged.
The custom object have three properties, and every property's value change per 50ms.
I add 30 custom objects to the Bindinglist<T>,and bind the list to radGridview.

I use the 2010 q2 version.
Julian Benkov
Telerik team
 answered on 25 Jan 2011
5 answers
328 views
Hi,

I've looked at a few examples of this but they don't appear to work. I'm getting an error when actually assigning the image. The error is Exception has been thrown by the target of an invocation.

The code that I'm trying is:
Private Sub rgvItems_CellFormatting(ByVal sender As Object, ByVal e As CellFormattingEventArgs) Handles rgvItems.CellFormatting
    If TypeOf e.CellElement.ColumnInfo Is GridViewCommandColumn AndAlso Not (TypeOf e.CellElement.RowElement Is GridTableHeaderRowElement) Then
        Dim column As GridViewCommandColumn = DirectCast(e.CellElement.ColumnInfo, GridViewCommandColumn)
        If column.Name = "PLButton" Then
            Dim element As RadButtonElement = DirectCast(e.CellElement.Children(0), RadButtonElement)
            element.DisplayStyle = Telerik.WinControls.DisplayStyle.Image
            ' This is an example of course
            element.Image = ImageList.Images(0)
            'e.CellElement.StringAlignment = StringAlignment.Center
            'Me.ApplyThemeToElement(element, "ControlDefault")
        End If
    End If
End Sub
The line where it seems to fail is element.image = imagelist.images(0). The imagelist is an image list surprisingly enough and it has images in it. They are being used elsewhere to populate an image column in the grid view.

Is there anything obvious stands out?

Thanks
Richard Slade
Top achievements
Rank 2
 answered on 25 Jan 2011
3 answers
153 views
We have included a bunch of Telerik's controls to our windows based application. One of them is Gridview control. While creating a deployment package, we have added all the dlls that are required - one of them is Telerik.Wincontrols.GridView.dll. When we try to install our application on our client's machine, it gives us an error - Unable to load file or reference to Telerik.Wincontrols.Gridview.dll. The dll is physicially present on the machine.
What are we missing here?
Richard Slade
Top achievements
Rank 2
 answered on 24 Jan 2011
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
PdfViewer and PdfViewerNavigator
CommandBar
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
Label
AutoCompleteBox
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
SyntaxEditor
Wizard
CollapsiblePanel
LayoutControl
ShapedForm
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
SmartPasteButton
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?