Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
220
Bind WebGrid to ObservableCollection
posted

Hi,

i've try to bind WebGrid to my ObservableCollection. I set the DataSource property and later I call DataBind(). Furthermore I define a BoundField and add it to the WebGrid Columns.
<ObservableCollection<myClass> myOberservableCollection;

<this.WebGrid.DataSource= myOberservableCollection;
<BoundFiled bf = new BoundField();
<bf.HeaderText = "Key";
<bf.DataField="Key";
<this.WebGrid.Columns.Add(bf);
<this.WebGrid.DataBind();


In my class which represent the items in my ObservableCollection I implement INotifyPropertyChanged Interface and the PropertyChangedEventHandler.
In all properties of this class I raise this event.

<public class myClass : INotifyPropertyChanged

<public event PropertyChangedEventHandler PropertyChanged;

<public void myPropertyChanged(string propertyname)
< { If (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyname));
<public int Key
< { get { return _key; } set { _key = value; myPropertyChanged("Key"); }

But the properties are never been raised! I guess something is missing!?

With similar behavoir on my WPF or Silverlight project it works fine with Infragistics Grid.

thx in advance

frank

Parents Reply Children
No Data