On click of the AddNewRecordButton, i want to hide button and the table header. On click of the addNewrecord, i can successfully hide the delete button on each row but the addNewRecord button still is visible! Also how can I hide the header?
I have a grid as follows. Add new record is a template.
I have a grid as follows. Add new record is a template.
this._RadGrid1.ID = "RadGrid1";
this._RadGrid1.Skin = "WebBlue";
this._RadGrid1.Width = Unit.Percentage(100);
this._RadGrid1.GridLines = GridLines.None;
this._RadGrid1.AllowSorting = true;
this._RadGrid1.AllowFilteringByColumn = false;
this._RadGrid1.ShowGroupPanel = false;
this._RadGrid1.AutoGenerateColumns = false;
this._RadGrid1.AutoGenerateDeleteColumn = false;
this._RadGrid1.AllowPaging = false;
this._RadGrid1.EnableLinqExpressions = false;
this._RadGrid1.MasterTableView.NoMasterRecordsText = "There are no documents associated with this order / quote / proposal.";
this._RadGrid1.ClientSettings.Selecting.AllowRowSelect = false;
this._RadGrid1.ClientSettings.EnableRowHoverStyle = true;
this._RadGrid1.ClientSettings.EnablePostBackOnRowClick = false;
this._RadGrid1.MasterTableView.DataKeyNames = new string[] { this._EntityDocumentumReferenceTable.EntityDocumentumReferenceIdColumn.ColumnName };
this._RadGrid1.NeedDataSource += RadGrid1_NeedDataSource;
this._RadGrid1.ItemDataBound += RadGrid1_ItemDataBound;
this._RadGrid1.ItemCommand += RadGrid1_ItemCommand;
if (ShowAdd)
{
this._RadGrid1.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = true;
this._RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
this._RadGrid1.MasterTableView.CommandItemSettings.AddNewRecordText = "Add Document";
this._RadGrid1.MasterTableView.EditFormSettings.EditFormType = GridEditFormType.Template;
this._RadGrid1.MasterTableView.EditFormSettings.FormTemplate = new AddDocumentTemplate(this._EntityId,
this._EntityType,
this._QuoteId,
this.CustomerNumber,
this.CompanyId,
this.ProposalNumber,
this.CatalogProductId);
}
The ItemDataBound is as follows:
private void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
//Access the Insert Form, disable delete when in insert mode
if (e.Item is GridEditableItem && !e.Item.IsInEditMode && e.Item.OwnerTableView.IsItemInserted)
{
this._RadGrid1.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false;
GridEditableItem insertItem = (GridEditableItem)e.Item;
ImageButton btnDelete = (ImageButton)dataItem["DeleteColumn"].Controls[0];
btnDelete.Visible = false;
//this._RadGrid1.ClientSettings.Selecting.AllowRowSelect = false;
}
}
}