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

Force refresh of values?

2 Answers 83 Views
GridView
This is a migrated thread and some comments may be shown as answers.
madladuk
Top achievements
Rank 2
madladuk asked on 03 Feb 2011, 05:29 PM
Hi all.

I have a radgrid that binds to a entity. I have a partial class that does some calculations, example field being 'mycount'. This field is shown correctly in the grid, however when a certain property updates I want this value to update. However when I go back to the grid the old value is there, until I navigate around the system and the context refreshes itself. Thus it field "x" changes I need the value of "mycount" to be updated. Could someone throw some light on this;

[global::System.Runtime.Serialization.DataMemberAttribute()]
       public int mycount
       {
           get
           {
               try
               {
                   return  this.MyChildEntity.Count;
               }
               catch (Exception ex)
               {
                   return 0;
               }
           }
       }

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 04 Feb 2011, 07:18 AM
Hello madladuk,

 You need to implement INotifyPropertyChanged for this object and raise PropertyChanged event when needed. 

Greetings,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
madladuk
Top achievements
Rank 2
answered on 04 Feb 2011, 10:30 AM
Hi could you give me some examples. Basically when the property "userstatus" changes I want to update the property "mycount", however you can see that this is a readonly field at the moment as this is not something the user updates but it used to provide an active count [plus some other functions]. I did try something like this but found that it still did not update the value

protected override void OnPropertyChanging(string property)
       {
           if (property == "managerstatus") base.ReportPropertyChanged("mycount");
           base.OnPropertyChanging(property);
       }

Thanks P
Tags
GridView
Asked by
madladuk
Top achievements
Rank 2
Answers by
Vlad
Telerik team
madladuk
Top achievements
Rank 2
Share this question
or