This is a migrated thread and some comments may be shown as answers.

Ganttview_ItemChanged Event

1 Answer 72 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
kim
Top achievements
Rank 1
kim asked on 15 Nov 2018, 11:51 PM

Hi,

 

GanttView has 2 columns

I change value on the screen TEXT1

I want change TEXT2 value without raising ganttView_ItemChanged event

 

GanttViewElement.Columns.Add(new GanttViewTextViewColumn("A", "TEXT1");

GanttViewElement.Columns.Add(new GanttViewTextViewColumn("B", "TEXT2");

ganttView_ItemChanged(object sender, GnattViewItemChangedEventArge e)

{

    if(e.PropertyName.Equals("TEXT1"))

    {

          var view = e.Item.DataBoundItem as DataRowView;

         view["TEXT2"] = "Test";   

     // this code is call ganttView_ItemChanged

    

}

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 19 Nov 2018, 09:04 AM
Hello, Kim, 

When an item's property is changed, it is normal that the ItemChanged event is fired if you have a subscription to it. In order to avoid it, you can unsubscribe from the event before setting the new value and then subscribe to it again. Here is demonstrated a sample code snippet:
private void radGanttView1_ItemChanged(object sender, GanttViewItemChangedEventArgs e)
{
    if (e.PropertyName.Equals("TEXT1"))
    {
        var view = e.Item.DataBoundItem as DataRowView;
 
        this.radGanttView1.ItemChanged -= radGanttView1_ItemChanged;
        view["TEXT2"] = "Test";  
        // this code is call ganttView_ItemChanged
        this.radGanttView1.ItemChanged += radGanttView1_ItemChanged;

I hope this information helps. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GanttView
Asked by
kim
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or