Hi,
Iam creating a masterview for a telerik grid and binding few columns on firsttime pageload. One among these columns is Editable column. But when I click on 2nd page in the grid, my editable column is displayed as a non-editable column. How to make sure that this column is always editable ? Is there any way to clear the grid view and reconfigure on every postback ? Please suggest.
Iam creating a masterview for a telerik grid and binding few columns on firsttime pageload. One among these columns is Editable column. But when I click on 2nd page in the grid, my editable column is displayed as a non-editable column. How to make sure that this column is always editable ? Is there any way to clear the grid view and reconfigure on every postback ? Please suggest.
protected
void
Page_Init()
{
ConfigureGrid();
}
private
void
ConfigureGrid()
{
OrderTypeRankingGrid.AddNeedDataSourceEventHandler(NeedDataSource);
// Binding master table view
OrderTypeRankingGrid.AddGridCommandEventHandler(DataGrid_ItemCommand);
// Events for the standard ngm controls
OrderTypeRankingGrid.AllowColumnsReorder =
false
;
OrderTypeRankingGrid.GridHeaderText =
"Order Type Ranking"
;
var masterView = OrderTypeRankingGrid.ConfigureMasterTableView(
"vDivisionOrderTypeRanking"
,
new
string
[] {
"DivisionOrderTypeRankId"
});
masterView.AllowFilteringByColumn =
true
;
masterView.AllowSorting =
true
;
masterView.FullEditMode =
true
;
masterView.EditMode = GridEditMode.InPlace;
masterView.EnableShowHideColumns =
true
;
masterView.SetPaging(GridPagerMode.NextPrevAndNumeric);
masterView.GridTableView.ShowHeader =
true
;
masterView.ShowHeader =
true
;
masterView.ShowFooter =
true
;
masterView.ShowHeadersWhenNoRecords =
true
;
masterView.AllowPaging =
true
;
//Enable standard Ngm controls
masterView.AddNgmCommandButton(NgmButtonType.Save,
"btnSave"
,
null
,
null
,
"Save Function Id"
, Unit.Pixel(50));
masterView.AddNgmCommandButton(NgmButtonType.Cancel,
null
,
null
,
null
,
null
, Unit.Pixel(50));
masterView.CommandItemDisplay = GridCommandItemDisplay.Bottom;
if
(!IsPostBack)
//must check for postback; otherwise, columns will be duplicated
{
//masterView.AddBoundColumn("DivisionOrderTypeRankId", "Rank ID", null, true, false, true, Unit.Percentage(7.0));
masterView.AddBoundColumn(
"CategoryCode"
,
"Category Code"
,
null
,
true
,
false
,
true
, Unit.Percentage(7.0));
masterView.AddBoundColumn(
"PurposeCode"
,
"Purpose Code"
,
null
,
true
,
false
,
true
, Unit.Percentage(7.0));
masterView.AddBoundColumn(
"ReasonCode"
,
"Reason Code"
,
null
,
true
,
false
,
true
, Unit.Percentage(7.0));
masterView.AddBoundColumn(
"ReasonDescription"
,
"Reason Description"
,
null
,
true
,
false
,
true
, Unit.Percentage(7.0));
masterView.AddBoundColumn(
"OrderTypeRank"
,
"Rank"
,
null
,
false
,
false
,
true
, Unit.Percentage(7.0));
}
}
protected
void
NeedDataSource(
object
source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
if
(IsPostBack)
{
if
(!e.IsFromDetailTable && (
this
.productDivision == 1 ||
this
.productDivision == 2))
{
IDivisionOrderTypeRankService divisionOrderTypeRankServiceAgent =
null
;
divisionOrderTypeRankServiceAgent = (IDivisionOrderTypeRankService)ContextRegistry.GetContext().GetObject(
"DivisionOrderTypeRankServiceAgent"
);
IList<DivisionOrderTypeRankDTO> divisionOrderTypeRankDTOs = divisionOrderTypeRankServiceAgent.GetDivisionOrderTypeRankByDivision(productDivision);
OrderTypeRankingGrid.DataSource = divisionOrderTypeRankDTOs;
}
}
}