4 Answers, 1 is accepted
grid.SelectedRecord.RecordManager.DeleteRecord(grid.Records.IndexOf(grid.SelectedRecord));
...but, this is the best way?
Can you post more info about how the grid is bound in your case?
Sincerely yours,
Vlad
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
// -> UI Constructor
public UIContry
{
InitializeComponent();
LoadGrid();
}
private void LoadGrid()
{
ServiceFactory session = new ServiceFactory();
session.ExecuteServiceMethod<ConsultService.LoadDataGridCompletedEventArgs>(typeof(ConsultServiceClient).FullName, LoadDataGridCompleted, "LoadDataGrid", "Country", "");
}
void LoadDataGridCompleted(object sender, LoadDataGridCompletedEventArgs e)
{
grid.DataBind(e.Result); // -> Extension method, e.result as a byte[]
}
// -> Extension Method of the RadGridView
public static void DataBind(this RadGridView grid, byte[] data)
{
// DataSet re-implemented (by ComponentOne)
MemoryStream str = new MemoryStream(data);
DataSet ds = new DataSet("DS");
ds.ReadXml(str);
ds.AcceptChanges();
grid.AutoGenerateColumns = false;
grid.ItemsSource = ds.Tables[0].DefaultView;
}
...this is populing the grid, but I want to click in the any button and remove (local) any row...
ComponentOne do it: grid.RemoveRow(grid.SelectedRow);
Here is an example:
DataView view = (DataView) RadGridView1.ItemsSource;
view.Remove(RadGridView1.SelectedItem);
All the best,
Vlad
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.