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

Paging in edit mode (InPlace)

5 Answers 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bhanu
Top achievements
Rank 1
Bhanu asked on 27 Jul 2010, 04:01 PM
Hi,

I have bound five columns to a telerik grid and the last column is in "InPlace" edit mode.
I have also enabled paging (GridPagerMode.NextPrevAndNumeric).
When the grid is loaded for the first time, the last column is displayed in edit mode.
But when I click on 2nd page, last column is also displayed in non-editable mode like other columns.

How can I make sure the last column is always displayed in edit mode (InPlace) ? Please suggest.
Your help is very much appreciated.

//Here is my grid configuration method
private void ConfigureGrid()
    {
  
        OrderTypeRankingGrid.AddNeedDataSourceEventHandler(NeedDataSource); 
        OrderTypeRankingGrid.AddGridCommandEventHandler(DataGrid_ItemCommand); 
         
        OrderTypeRankingGrid.AllowColumnsReorder = false;
           
        OrderTypeRankingGrid.GridHeaderText = "Order Type Ranking"
        var masterView = OrderTypeRankingGrid.ConfigureMasterTableView("vDivisionOrderTypeRanking", new string[] { "DivisionOrderTypeRankId","CategoryCode", "PurposeCode", "ReasonCode", "ReasonDescription"});
        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;
          
         
          
        masterView.AddNgmCommandButton(NgmButtonType.Save, "btnSave", null, null, null, 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("CategoryCode", "Category Code", "CategoryCode", true, false, true, Unit.Percentage(7.0));
            masterView.AddBoundColumn("PurposeCode", "Purpose Code", "PurposeCode", true, false, true, Unit.Percentage(7.0));
            masterView.AddBoundColumn("ReasonCode", "Reason Code", "ReasonCode", true, false, true, Unit.Percentage(7.0));
            masterView.AddBoundColumn("ReasonDescription", "Reason Description", "ReasonDescription", true, false, true, Unit.Percentage(7.0));
            masterView.AddBoundColumn("OrderTypeRank", "Rank", "OrderTypeRank", false, false, true, Unit.Percentage(7.0));
  
        }
  
          
    }
  
//Here is the NeedDataSource method
  
    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;
                  
                  
            }
        }
    }

5 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 30 Jul 2010, 02:18 PM
Hello Bhanu,

I am sending you a simple example which demonstrates the desired functionality. Please check it out and let me know if it helps you.

Kind regards,
Radoslav
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
0
Bhanu
Top achievements
Rank 1
answered on 01 Aug 2010, 04:59 PM
Thanks for your reply and the attached example is working fine. However, we are using a customized datagrid user control with a wrapper class. Can you please let me know what are the changes need to be done in these files ?

I have added the below lines to the wrapper class because these 2 properties are not defined :
public int PageCount
        {
              
            get { return GridTableView.PageCount; } 
        }
  
public GridIndexCollection EditIndexes { get  ; set; }   //Is it right ??
// because I see this is a readonly property. But when I remove "set;", it gives me error that either you have to write both "get; set;" or write only get in this way - get { return whattoreturnhere; }
and I have added the below code in my web page in which datacontrol is added.

void OrderTypeRankingGrid_PreRender(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            for (int i = 0; i < OrderTypeRankingGrid.PageCount; i++)
            { //Exception is being thrown : Object ref not set to an instance of an object on the below line
                OrderTypeRankingGrid.EditIndexes.Add(i);
            }
  
            OrderTypeRankingGrid.Rebind();
        }
  
  
    }

Your help is very much appreciated, thank you.
0
Radoslav
Telerik team
answered on 04 Aug 2010, 12:22 PM
Hi Bhanu,

Indeed the EditIndexes is read only and you could not assign it a value which is of GridItemCollection type. However you could add items to the EditIndexes collection. So in your case you have not declare your own EditIndexes { get  ; set; } property. Could you please try removing the EditIndexes { get  ; set; } declaration from your code and let me know if the issue still persists.

Sincerely yours,
Radoslav
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
0
Bhanu
Top achievements
Rank 1
answered on 04 Aug 2010, 06:17 PM
Hi,

Thanks so much for your response. My problem is resolved by the following changes.
I have added the below code in the customized grid control (which has one GridView Wrapper class also).

public int PageCount 
{ get { return RadGrid1.PageCount; }  } 
  
public GridIndexCollection EditIndexes
{ get { return RadGrid1.EditIndexes; }  }
  
and then the FOR loop in the radgrid prerender method.

Keep up the good work !!
0
Radoslav
Telerik team
answered on 05 Aug 2010, 07:49 AM
Hello Bhanu,

I am glad that you achieved the desired functionality.
If you need further assistance, do not hesitate to contact us again.

All the best,
Radoslav
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
Radoslav
Telerik team
Bhanu
Top achievements
Rank 1
Share this question
or