Trouble with GridCalculatedColumn

5 posts, 1 answers
  1. Andrew
    Andrew avatar
    7 posts
    Member since:
    Aug 2009

    Posted 15 Sep 2009 Link to this post

        I'm having some trouble with the GridCalculatedColumn in the RadGrid.  My columns definition is as follows:

     

                <Columns> 
                    <telerik:GridBoundColumn HeaderText="Quantity" DataField="Quantity" /> 
                    <telerik:GridBoundColumn HeaderText="ExpectedQuantity" DataField="ExpectedQuantity" /> 
                    <telerik:GridCalculatedColumn HeaderText="Remaining" DataType="System.Int32" 
                        Expression="{0}-{1}" DataFields="ExpectedQuantity, Quantity" /> 
                    <telerik:GridBoundColumn HeaderText="NDC" DataField="TheDrug.NDC" /> 
                    <telerik:GridBoundColumn HeaderText="Name" DataField="TheDrug.DrugName" /> 
                    <telerik:GridBoundColumn HeaderText="Lot #" DataField="LotNumber" /> 
                    <telerik:GridBoundColumn HeaderText="Expires" DataField="ExpirationDate" /> 
                    <telerik:GridButtonColumn CommandName="Delete" Text="Delete" ItemStyle-Font-Underline="true" UniqueName="DeleteColumn" 
                        ConfirmText="Remove medication from box?" /> 
                </Columns> 
     

    But I'm getting a ParseException when I view the page.  It's a pretty simple expression.  Can anyone tell me what I'm missing?

    Thanks,
      Andy


    BTW, the complete text of the exception is:
    )' or ',' expected   
    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: Telerik.Web.UI.ParseException: ')' or ',' expected  
     
    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:   
     
     
    [ParseException: ')' or ',' expected]  
       Telerik.Web.UI.ExpressionParser.ValidateToken(TokenId t, String errorMessage) +89  
       Telerik.Web.UI.ExpressionParser.ParseNew() +543  
       Telerik.Web.UI.ExpressionParser.ParseIdentifier() +259  
       Telerik.Web.UI.ExpressionParser.ParsePrimaryStart() +65  
       Telerik.Web.UI.ExpressionParser.ParsePrimary() +36  
       Telerik.Web.UI.ExpressionParser.ParseUnary() +365  
       Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +54  
       Telerik.Web.UI.ExpressionParser.ParseAdditive() +54  
       Telerik.Web.UI.ExpressionParser.ParseComparison() +57  
       Telerik.Web.UI.ExpressionParser.ParseLogicalAnd() +49  
       Telerik.Web.UI.ExpressionParser.ParseLogicalOr() +49  
       Telerik.Web.UI.ExpressionParser.ParseExpression() +60  
       Telerik.Web.UI.ExpressionParser.Parse(Type resultType) +58  
       Telerik.Web.UI.DynamicExpression.ParseLambda(ParameterExpression[] parameters, Type resultType, String expression, Object[] values) +81  
       Telerik.Web.UI.DynamicExpression.ParseLambda(Type itType, Type resultType, String expression, Object[] values) +114  
       Telerik.Web.UI.GridDynamicQueryable.Select(IQueryable source, String selector, Object[] values) +173  
       Telerik.Web.UI.GridDataTableFromEnumerable.FillData35() +2699  
       Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +1010  
       Telerik.Web.UI.GridResolveEnumerable.Initialize() +55  
       Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +40  
       Telerik.Web.UI.GridResolveEnumerable.get_DataTable() +31  
       Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +221  
       Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +155  
       Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +556  
       Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +219  
       Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +73  
       System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57  
       System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114  
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31  
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142  
       Telerik.Web.UI.GridTableView.PerformSelect() +28  
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73  
       Telerik.Web.UI.GridTableView.DataBind() +368  
       Telerik.Web.UI.RadGrid.DataBind() +165  
       Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +3856  
       Telerik.Web.UI.RadGrid.OnLoad(EventArgs e) +175  
       System.Web.UI.Control.LoadRecursive() +50  
       System.Web.UI.Control.LoadRecursive() +141  
       System.Web.UI.Control.LoadRecursive() +141  
       System.Web.UI.Control.LoadRecursive() +141  
       System.Web.UI.Control.LoadRecursive() +141  
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627  
     
       
     

  2. Kishan Gandikota
    Kishan Gandikota avatar
    44 posts
    Member since:
    Sep 2009

    Posted 16 Sep 2009 Link to this post

    Hi,

    I am also facing this same problem. I couldn't use this telerik:GridCalculatedColumn. Please let me know how to proceed on this. I have pasted the sample code that I have.

    <telerik:GridBoundColumn Aggregate="Sum" DataField="TotalShares" HeaderText="Total No. of Shares"
                                    DataType="System.Double" FooterText=" ">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn Aggregate="Sum" DataField="MarketValue" HeaderText="Market Value"
                                    DataType="System.Double" FooterText=" ">
                                </telerik:GridBoundColumn>                            
                                <telerik:GridCalculatedColumn HeaderText="Total Price" UniqueName="TotalPrice" DataType="System.Double"
                                    DataFields="TotalShares, MarketValue" Expression="{0}*{1}" Aggregate="Sum" />


    Regards,
    Kishan G K
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 18 Sep 2009 Link to this post

    Hi Andrew,
    hello Kishan,

    Try setting EnableLinqExpressioins to false for the grid - this should fix prevent the parsing exception.

    I hope this helps.

    Sincerely yours,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Andrew
    Andrew avatar
    7 posts
    Member since:
    Aug 2009

    Posted 21 Sep 2009 Link to this post

    That seems to have done it.

    Thanks,
      Andrew
  6. Kishan Gandikota
    Kishan Gandikota avatar
    44 posts
    Member since:
    Sep 2009

    Posted 24 Sep 2009 Link to this post

    Thatz gr8. I was waiting for the solution and here u are...
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017