Simple scenario: I want the edit form to appear above the column headers and I also want to hide the command item "row". I am not looking for a solution involving modals or placing the form outside of the radgrid.
Here's my code so far:
But during asynch postbacks all goes to hell: the edit form disappears.
Here's my code so far:
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
RadGrid1.MasterTableView.IsItemInserted =
true
;
RadGrid1.Rebind();
}
GridCommandItem commandItem = RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0]
as
GridCommandItem;
commandItem.Visible = !RadGrid1.MasterTableView.IsItemInserted;
if
(!commandItem.Visible)
// If edit form is open
{
GridEditFormItem editFormItem = RadGrid1.MasterTableView.GetItems(GridItemType.EditFormItem)[0]
as
GridEditFormItem;
editFormItem.Parent.Controls.Remove(editFormItem);
commandItem.Parent.Controls.AddAt(0, editFormItem);
}
}
But during asynch postbacks all goes to hell: the edit form disappears.