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
300
Is it possible to have custom columns in a databound grid?
posted

I have my grid databound to an ObjectDataSource--the out of the box functionality of the grid does not cover our needs, so we were looking to extend the grid using client-side code. 

One problem--how do I add non-bound columns to the grid? When I try, it pukes. Sorry if this is a rudimentary concept that I overlooked. When I tried to use the site search for "databound grid" nothing returned. Nothing valuable was returned from "ObjectDataSource TemplateDataField" either.

Parents
No Data
Reply
  • 300
    posted

    When trying to use: 

         <ig:TemplateDataField Key="ItemSelected">

                                <Header Text="Select Row" />

                                <ItemTemplate>

                                    <asp:CheckBox ID="itemCheck" runat="server" />

                                </ItemTemplate>

                            </ig:TemplateDataField>

     

    I get: 

    The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.]
       System.Web.UI.ControlCollection.Add(Control child) +11328292
       Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.get_TemplateContainerControl() +143
       Infragistics.Web.UI.Framework.RunBot.InstantiateTemplate(ITemplatedObject item, ITemplate template, String templateContainerID) +142
       Infragistics.Web.UI.GridControls.BaseGrid.InstantiateTemplate(ITemplatedGridObject item, ITemplate defaultTemplate, String id) +302
       Infragistics.Web.UI.GridControls.WebDataGrid.InstantiateTemplates() +1103
       Infragistics.Web.UI.GridControls.WebDataGrid.DataBind() +941
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +105
       Infragistics.Web.UI.GridControls.WebDataGrid.CreateChildControls() +43
       System.Web.UI.Control.EnsureChildControls() +182
       System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +35
       System.Web.UI.WebControls.DataBoundControlHelper.FindControl(Control control, String controlID) +143
       System.Web.UI.WebControls.DataBoundControl.GetDataSource() +88
       Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.GetDataSourceObject(Boolean designModeCheck) +176
       Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.GetDataSource() +49
       System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +255
       System.Web.UI.WebControls.DataBoundControl.OnLoad(EventArgs e) +28
       System.Web.UI.Control.LoadRecursive() +71
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1              

     

Children
No Data