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

Grid Features unavailable in Grid in ASCX file

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hk
Top achievements
Rank 2
Hk asked on 23 Nov 2008, 02:31 PM
Hi,
i'm trying to implement a simple demo you wrote on this address:
http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/GeneralFeatures/CalculatedColumns/DefaultCS.aspx

With the change that I implement the code in a control. You can assume the control inherits <scriptManager>. The page that loads the control does that thorugh the TabStrip comp.

The problem is that when I try to filter the data using the GUI, I get an error: "Object reference is not set to an object". When I put the same code in a single ASPX file, It works fine. I had several problems with grid examples in your site when I tried to include them as controls.

Can you please check it out?
        <!-- content start --> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadGrid1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <telerik:RadGrid ShowGroupPanel="true" AutoGenerateColumns="false" ID="RadGrid1" 
            DataSourceID="SqlDataSource1" Skin="Vista" AllowFilteringByColumn="True" AllowSorting="True" 
            ShowFooter="True" runat="server" GridLines="None" AllowPaging="true"
            <PagerStyle Mode="NextPrevAndNumeric" /> 
            <MasterTableView AllowMultiColumnSorting="true"
                <Columns> 
                    <telerik:GridBoundColumn Aggregate="Count" DataField="id" HeaderText="Product ID" 
                        FooterText="Total products: "
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="title" HeaderText="Product name" SortExpression="title" 
                        UniqueName="title"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn Aggregate="Sum" DataField="price" HeaderText="Unit price" 
                        FooterText="Total price: "
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn Aggregate="Sum" DataField="amount" HeaderText="Units in stock" 
                        FooterText="All units in stock: "
                    </telerik:GridBoundColumn> 
                    <telerik:GridCalculatedColumn HeaderText="Total Price" UniqueName="TotalPrice" DataType="System.Double" 
                        DataFields="price, amount" Expression="{0}*{1}" FooterText="Total : " Aggregate="Sum" /> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true" /> 
        </telerik:RadGrid> 
        <asp:Button ID="Button1" Text="PostBack!" CssClass="button" Style="margin: 10px 22px 10px 0px" 
            runat="server"></asp:Button> 
        Click PostBack to see the state of the grid is preserved. 
        <br /> 
        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="Data Source=vmsmc;Initial Catalog=hadar;User ID=sa" 
            SelectCommand="SELECT * FROM tblProducts" runat="server"></asp:SqlDataSource> 
    </div> 
 



1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 26 Nov 2008, 12:36 PM
Hello Hadar,

From your description I assume that there is some kind of issue with the implementation of your custom control because you specified that a stand-alone demo of the grid on a plain page works properly. Note that the same demo is available in your local RadControls for ASP.NET AJAX installation at this location:

C:\Program Files\telerik\RadControls for ASPNET AJAX Q3 2008\Live Demos\Grid\Examples\GeneralFeatures\CalculatedColumns

To progress in our investigation, I suggest you prepare a stripped working version of your project (including the custom control which hosts regular RadGrid for ASP.NET AJAX instance) and send it attached to a formal support ticket. Thus we will be able examine your code logic and provide further directions/assistance.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Hk
Top achievements
Rank 2
Answers by
Sebastian
Telerik team
Share this question
or