set SelectedObject but don't Initialization

5 posts, 0 answers
  1. DFOCUS
    DFOCUS avatar
    3 posts
    Member since:
    Dec 2011

    Posted 22 Apr 2012 Link to this post

    How to update data on RadPropertyGrid?

    I want to change propertygrid data, whever change listview selection.
    but, it's not refresh, but also append...

    What's wrong with my code?

    Here is my code...
    private RadPropertyStore CreatePropertyStore(string uid)
    {
        RadPropertyStore vInfoStore = new RadPropertyStore();
        DataTable dt = Global.www.GetVirtualMachine(uid);
        PropertyStoreItem v_nm = new PropertyStoreItem(typeof(string), "Name", dt.Rows[0]["v_nm"],
                        "Name", "INFO");
        vInfoStore.Add(v_nm);
     
        return vInfoStore;
    }
     
    private void radListView1_SelectedIndexChanged(object sender, EventArgs e)
    {
                ListViewDataItem item = radListView1.SelectedItem;
                string uid = item["uid2"].ToString();
     
                this.radPropertyGrid1.SelectedObject = CreatePropertyStore(uid);
     }
     
  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 23 Apr 2012 Link to this post

    Hello,

    Thanks for writing.

    This is a known issue of RadPropertyGrid which we will address in the upcoming release (Q2 2012). To work around it, you should modify your code as follows:
    private void radListView1_SelectedIndexChanged(object sender, EventArgs e)
    {
      ListViewDataItem item = radListView1.SelectedItem;
      string uid = item["uid2"].ToString();
      
      this.radPropertyGrid1.SelectedObject = null;
      this.radPropertyGrid1.SelectedObject = CreatePropertyStore(uid);
    }

    I hope this will help. If you need further assistance, I would be glad to provide it.
     
    Greetings,
    Ivan Petrov
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. DFOCUS
    DFOCUS avatar
    3 posts
    Member since:
    Dec 2011

    Posted 25 Apr 2012 Link to this post

    Thank you for your help.
    But, do not properly working...same behavior.
  5. DFOCUS
    DFOCUS avatar
    3 posts
    Member since:
    Dec 2011

    Posted 27 Apr 2012 Link to this post

    Please let me know if you have any other solution...
  6. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 30 Apr 2012 Link to this post

    Hi,

    Thank you for writing us back.

    Indeed, the provided code is not working properly when using our latest release - Q1 2012 SP1. As my colleague said, the issue will be addressed in our next release - Q2 2012. 

    You can solve the issue by adding a call to the ListSource.Clear method. Here is a sample:
    grid.SelectedObject = null;
    grid.PropertyGridElement.PropertyTableElement.ListSource.Clear();
    grid.SelectedObject = CreatePropertyStore("test");

    I hope this helps.
     
    All the best,
    Jack
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready