How can we move a row to a specified position. Example - 10 Rows. I would like to enter 5row in the textbox the selected row should be moved to the 5th row. The functionality should work even for multiple row selection.
Secondly, if the user selects just a column, i should able to hightlight whole row. How can we do this?
Thanks
Satish
>Here is a button handler that works for me in the sample to insert a row at the current position.
>
>
>private void button3_Click(object sender, System.EventArgs e)
>{
> this.gridDataBoundGrid1.BeginUpdate();
> CurrencyManager cm = (CurrencyManager)this.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember];
> DataView dv = (DataView)cm.List;
> int fromPos = cm.Position;
> int toPos = cm.Count;
> string saveSort = dv.Sort;
> dv.Sort = "";
> cm.AddNew();
> DataRowView drv1 = (DataRowView) cm.List[toPos];
> drv1.Row["sortKey"] = toPos;
> dv.Sort = saveSort;
> for(int i = toPos; i > fromPos; i--)
> {
> Swap(i, i-1);
> cm.EndCurrentEdit();
> }
> cm.Position = fromPos;
> this.gridDataBoundGrid1.EndUpdate();
>}
>