Hello,
I am adding a row to a child grid in the OnInsertCommand event. This is working as expected. But I would like to move to the last page in the grid and select the row that was just inserted. I am doing the following, but I always remain on the first page of the child grid.
In this example, "Systems" is the name of the Detail grid view.
also, is there away to do this without doing so many rebind calls?
Thanks
-marcos
I am adding a row to a child grid in the OnInsertCommand event. This is working as expected. But I would like to move to the last page in the grid and select the row that was just inserted. I am doing the following, but I always remain on the first page of the child grid.
| protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e) |
| { |
| string serverID = null; |
| string insertType = "master"; |
| GridEditFormItem gridEditFormItem = (GridEditFormItem)e.Item; |
| Hashtable ht = new Hashtable(); |
| gridEditFormItem.ExtractValues(ht); |
| if ("Systems".Equals(e.Item.OwnerTableView.Name)) |
| { |
| GridDataItem parentItem = (GridDataItem)e.Item.OwnerTableView.ParentItem; |
| serverID = parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["ServerID"].ToString(); |
| insertType = "detail"; |
| } |
| presenter.InsertRecord(serverID, ht, insertType); |
| XmlDataSource1.Save(); |
| //rebind to get the real number of pages (incase adding an item increased the page count |
| RadGrid1.Rebind(); |
| if ("Systems" != e.Item.OwnerTableView.Name) |
| { |
| //set to last page |
| RadGrid1.CurrentPageIndex = RadGrid1.PageCount - 1; |
| //after changing page, need to rebind |
| RadGrid1.Rebind(); |
| } |
| else |
| { |
| GridTableView table = e.Item.OwnerTableView; |
| //set to last page |
| table.CurrentPageIndex = table.PageCount - 1; |
| //after changing page, need to rebind |
| table.Rebind(); |
| } |
| } |
In this example, "Systems" is the name of the Detail grid view.
also, is there away to do this without doing so many rebind calls?
Thanks
-marcos