Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
510
Editor Controls getting lost when rebinding the grid
posted

Hi,

I am using ultrawebgrid in my pages. I am specifying the EditorControl by setting EditorControlID in the InitializeLayout event of the grid. This works fine if I don't have paging or if I am not rebinding the grid. When I enable the paging, the EditorControl works fine in the first page. But when we move to the next page, the EditorControl get's lost. The same is the case when I rebind the grid (as I did in paging). I am giving you the sample code below. Can anyone please help me in resolving this?

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
          InitializePage();
        }
    }

private void InitializePage()
{
 PopulateReportingPeriodTasksGrid();
 Infragistics.WebUI.UltraWebGrid.UltraWebGrid comboGrid = (Infragistics.WebUI.UltraWebGrid.UltraWebGrid)StatusCombo.Controls[0];
 comboGrid.DisplayLayout.AllowAddNewDefault = Infragistics.WebUI.UltraWebGrid.AllowAddNew.Yes;
 comboGrid.DisplayLayout.AllowUpdateDefault = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes;
}

private void PopulateReportingPeriodTasksGrid()
{
 DataSet ds = new DataSet();
 ds.Clear();
 ds = DataService.ListReportingPeriodTask(UserIdentity, (int)TaskStatus.Status.Open);
 if (ds != null)
 {
     ReportingPeriodTasksGrid.DataSource = ds.Tables[0].DefaultView;
     ReportingPeriodTasksGrid.DataBind();
 }
}

protected void ReportingPeriodTasksGrid_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)
{
 e.Layout.Bands[0].Columns.FromKey("TaskStatus").Header.Caption = "Status";
        e.Layout.Bands[0].Columns.FromKey("TaskStatus").Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom;
        e.Layout.Bands[0].Columns.FromKey("TaskStatus").EditorControlID = "StatusCombo";
        e.Layout.Bands[0].Columns.FromKey("TaskStatus").AllowUpdate = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes;
        e.Layout.Pager.AllowPaging = true;
        e.Layout.Pager.PageSize = 25;
}

protected void ReportingPeriodTasksGrid_PageIndexChanged(object sender, Infragistics.WebUI.UltraWebGrid.PageEventArgs e)
{
 this.ReportingPeriodTasksGrid.DisplayLayout.Pager.CurrentPageIndex = e.NewPageIndex;
 PopulateReportingPeriodTasksGrid();
}

This is one scenario as I explained above...in case page index changed, I am calling the PopulateReportingPeriodTasksGrid() function again and that's when the EditorControl stops working. I've another page, where I am not using "paging", but doing the same as I am doing in the PopulateReportingPeriodTasksGrid procedure. Even in that case, the EditorControl will not work.

 

Thanks,

Kala

  • 510
    posted

    Anyone? Any thoughts?

    In fact, it looks like it's happening on Postback. Am I missing something in restoring the state or something like that? Can you please test the same in a sample application? I tried setting the postback properties to true for the grid but it didn't work!

    Thanks,

    Kala