hi i have a datagrid binded to a datatable.
i want to delete the selected record in the datagrid i did something like
this

CurrencyManager cm = (CurrencyManager)
Grid.BindingContext[CommonDataset.Tables[0]];
DataRowView row = (DataRowView) cm.Current;
row.Delete();
cm.EndCurrentEdit();
DataRow[]
dr=CommonDataset.Tables[0].Select(null,null,DataViewRowState.Deleted);
commonAdapter.Update(dr);

But somtimes the selected record is not deleted but some other record is
deleted ......

Re: deleting selected row in datagrid by ClayB

ClayB
Fri Jun 04 03:43:05 CDT 2004

Just something to try.

Instead of

CurrencyManager cm = (CurrencyManager)
Grid.BindingContext[CommonDataset.Tables[0]];

try

CurrencyManager cm = (CurrencyManager)
Grid.BindingContext[Grid.DataSource, Grid.DataMember];

=====================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools


"NotYetaNurd" <NotYetaNurd@Matrix.com> wrote in message
news:%23%234JPcfSEHA.3476@tk2msftngp13.phx.gbl...
> hi i have a datagrid binded to a datatable.
> i want to delete the selected record in the datagrid i did something like
> this
>
> CurrencyManager cm = (CurrencyManager)
> Grid.BindingContext[CommonDataset.Tables[0]];
> DataRowView row = (DataRowView) cm.Current;
> row.Delete();
> cm.EndCurrentEdit();
> DataRow[]
> dr=CommonDataset.Tables[0].Select(null,null,DataViewRowState.Deleted);
> commonAdapter.Update(dr);
>
> But somtimes the selected record is not deleted but some other record is
> deleted ......
>
>
>
>



Re: deleting selected row in datagrid by NotYetaNurd

NotYetaNurd
Fri Jun 04 03:58:36 CDT 2004

actually ... i have a seperate form for adding new records ..
when i add new records and clear the dataset fill it once more then hit
delete this problem is happening (specifically happening for the every
second record i insert)
:-(



"ClayB [Syncfusion]" <clayb@syncfusion.com> wrote in message
news:u8Ul0$gSEHA.2112@TK2MSFTNGP11.phx.gbl...
> Just something to try.
>
> Instead of
>
> CurrencyManager cm = (CurrencyManager)
> Grid.BindingContext[CommonDataset.Tables[0]];
>
> try
>
> CurrencyManager cm = (CurrencyManager)
> Grid.BindingContext[Grid.DataSource, Grid.DataMember];
>
> =====================
> Clay Burch, .NET MVP
>
> Visit www.syncfusion.com for the coolest tools
>
>
> "NotYetaNurd" <NotYetaNurd@Matrix.com> wrote in message
> news:%23%234JPcfSEHA.3476@tk2msftngp13.phx.gbl...
> > hi i have a datagrid binded to a datatable.
> > i want to delete the selected record in the datagrid i did something
like
> > this
> >
> > CurrencyManager cm = (CurrencyManager)
> > Grid.BindingContext[CommonDataset.Tables[0]];
> > DataRowView row = (DataRowView) cm.Current;
> > row.Delete();
> > cm.EndCurrentEdit();
> > DataRow[]
> > dr=CommonDataset.Tables[0].Select(null,null,DataViewRowState.Deleted);
> > commonAdapter.Update(dr);
> >
> > But somtimes the selected record is not deleted but some other record is
> > deleted ......
> >
> >
> >
> >
>
>