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

set SelectedObject but don't Initialization

4 Answers 135 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
DFOCUS
Top achievements
Rank 1
DFOCUS asked on 23 Apr 2012, 01:25 AM
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);
 }
 

4 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 23 Apr 2012, 03:11 PM
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 >>
0
DFOCUS
Top achievements
Rank 1
answered on 25 Apr 2012, 06:30 AM
Thank you for your help.
But, do not properly working...same behavior.
0
DFOCUS
Top achievements
Rank 1
answered on 27 Apr 2012, 02:31 PM
Please let me know if you have any other solution...
0
Jack
Telerik team
answered on 30 Apr 2012, 06:14 AM
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 >>
Tags
PropertyGrid
Asked by
DFOCUS
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
DFOCUS
Top achievements
Rank 1
Jack
Telerik team
Share this question
or