1

I have Hierarchical data grid in Callback mode.

<ComponentArt:DataGrid ID="dgBL" runat="server" AllowColumnResizing="true" EmptyGridText="There is no data to display!"
LoadingPanelPosition="MiddleCenter" PagerStyle="Numbered" RunningMode="Callback" SearchOnKeyPress="true"
ShowFooter="true" ShowHeader="true" ShowSearchBox="true" AutoTheming="true" PreloadLevels="false"
GroupingNotificationText="Business Lines and their Departments" FillContainer="false" Width="60%"
Height="468px" AllowVerticalScrolling="true" AllowMultipleSelect="false">
<Levels>
    <ComponentArt:GridLevel AllowGrouping="false" DataKeyField="BLID" AllowReordering="false">
        <Columns>
            <ComponentArt:GridColumn DataField="BLID" Visible="false" Width="1" />
            <ComponentArt:GridColumn DataField="Name" HeadingText="Business Line Name" Visible="true" />
            <ComponentArt:GridColumn DataField="DepartmentCount" HeadingText="Department Count" Visible="true" Width="140" />
            <ComponentArt:GridColumn DataField="IsActive" HeadingText="Is Active" Visible="true" Width="80" />
            <ComponentArt:GridColumn Align="Center" AllowSorting="False" DataCellServerTemplateId="AddDepartmentTemplate"
                HeadingText="Add Department" Width="100" />
        </Columns>
    </ComponentArt:GridLevel>
    <ComponentArt:GridLevel AllowGrouping="false" DataKeyField="DepartmentID" AllowReordering="false">
        <Columns>
            <ComponentArt:GridColumn DataField="DepartmentID" Visible="false" Width="30" />
            <ComponentArt:GridColumn DataField="DepartmentName" HeadingText="Department Name" Visible="true" />
            <ComponentArt:GridColumn DataField="Transit" HeadingText="Transit" Visible="true" Width="80" />
            <ComponentArt:GridColumn DataField="BLID" Visible="false" Width="30" />
            <ComponentArt:GridColumn DataField="IsActive" HeadingText="Is Active" Visible="true" Width="80" />
            <ComponentArt:GridColumn Align="Center" AllowSorting="False" DataCellServerTemplateId="EditDepartmentTemplate1"
                HeadingText="Edit" Width="80" />
        </Columns>
    </ComponentArt:GridLevel>
</Levels>
<ServerTemplates>
    <ComponentArt:GridServerTemplate ID="AddDepartmentTemplate">
        <Template>
            <asp:ImageButton ID="addNewDepartment" runat="server" ImageUrl="~/App_Themes/OnlineForms/Images/add.png"
                OnClick="DGBL_AddNewDepartment_Click" Width="16" Height="16" CssClass="VerticalAlignMiddle" AlternateText="Add a Department for selected business"
                ToolTip="Add a Department for selected business" />
        </Template>
    </ComponentArt:GridServerTemplate>
    <ComponentArt:GridServerTemplate ID="EditDepartmentTemplate1">
        <Template>
            <asp:ImageButton ID="imgEditDepartment" runat="server" ImageUrl="../App_Themes/OnlineForms/Images/edit.gif"
                OnClick="imgEditDepartment_Click" CssClass="VerticalAlignMiddle" AlternateText="Edit selected Department"
                ToolTip="Edit selected Department" />
        </Template>
    </ComponentArt:GridServerTemplate>
</ServerTemplates>

When both levels are loaded and one of the top levels is expanded to display the inner level, and the addNewDepartment is clicked, there is a cancel button there. It displays an error message saying:

Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Property not found in object of type System.Data.Entity.DynamicProxies.BusinessLine_29A53EE537AE4FBDCCCC328C86AED34485458642B12DFD38012946895CAB887D

BusinessLine being a data object that is supplied as List to the DataSource for the top GridLevel.

The CS code snippet is as follows:

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);

    dgBL.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings[CommonConstants.DEFAULT_PAGE_SIZE]);

    dgBL.NeedDataSource += new Grid.NeedDataSourceEventHandler(dgBL_NeedDataSource);
    dgBL.NeedRebind += new Grid.NeedRebindEventHandler(dgBL_NeedRebind);
    dgBL.NeedChildDataSource += new Grid.NeedChildDataSourceEventHandler(dgBL_NeedChildDataSource);
}

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        dgBL.DataSource = GetAllBusinessLines();
        dgBL.DataBind();
    }
}

private void dgBL_NeedChildDataSource(object sender, GridNeedChildDataSourceEventArgs e)
{
    int blID = Convert.ToInt32(e.Item["BLID"]);

    UserManager um = new UserManager();
    e.DataSource = um.getAllDepartments(blID);
}

protected void dgBL_NeedDataSource(object sender, EventArgs e)
{
    dgBL.DataSource = GetAllBusinessLines();
}

protected void dgBL_NeedRebind(object sender, EventArgs e)
{
    dgBL.DataBind();
}

protected void dgBL_PageIndexChanged(object sender, ComponentArt.Web.UI.GridPageIndexChangedEventArgs e)
{
    throw new NotImplementedException();
}

protected void DGBL_AddNewDepartment_Click(object sender, EventArgs e)
{
    lblAddEditDepartment.InnerText = "Add Department";
    ShowControls(true);
    LoadDropDowns(getCurrentBLID());
}

protected void btnCancel_Click(object sender, EventArgs e)
{
    dgBL.DataSource = GetAllBusinessLines();
    dgBL.DataBind();
}

Any help would be appreciated.

EDIT: I just found a method call that solved this in the earlier versions:

Grid1.TableCache = null; // clear out cached child data
Grid1.callback();

But they don't exist in the 2012 version of component art datagrid. If anyone knows how this can be handled in 2012 version, I believe it would solve the problem.

Charlie
  • 183
  • 1
  • 2
  • 13
  • it's saying a property is missing on the PROXY object, not the DAO object from entity framework. Do you know which property is missing? It should tell you. – Brian Mains Mar 05 '13 at 13:51
  • It doesn't display the name, but I haven't added any property thats not there in the DAO – Charlie Mar 05 '13 at 13:52
  • To be more specific, this is what I get: Callback error:Property not found in object of type System.Data.Entity.DynamicProxies.BusinessLine_29A53EE537AE4FBDCCCC328C86AED34485458642B12DFD38012946895CAB887D. If you notice, there are 2 spaces between "Property not" indicating that the propery name is not being displayed in the error. – Charlie Mar 05 '13 at 14:36

0 Answers0