This is a migrated thread and some comments may be shown as answers.

Binding column in edit mode

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bhanu
Top achievements
Rank 1
Bhanu asked on 26 Jul 2010, 04:17 PM
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.

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, truefalse, 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;
                  
            }
        }
    }

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 29 Jul 2010, 03:09 PM
Hello Bhanu,

You can find a working implementation of Excel-like RadGrid in the following code-library:
Excel-like RadGrid CL

All the best,
Maria Ilieva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Bhanu
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or