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

Grid Features unavailable in Grid in ASCX file

1 Answer 47 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Hk asked on 23 Nov 2008, 02:31 PM
i'm trying to implement a simple demo you wrote on this address:

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"
                <telerik:AjaxSetting AjaxControlID="RadGrid1"
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
        <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"
                    <telerik:GridBoundColumn Aggregate="Count" DataField="id" HeaderText="Product ID" 
                        FooterText="Total products: "
                    <telerik:GridBoundColumn DataField="title" HeaderText="Product name" SortExpression="title" 
                    <telerik:GridBoundColumn Aggregate="Sum" DataField="price" HeaderText="Unit price" 
                        FooterText="Total price: "
                    <telerik:GridBoundColumn Aggregate="Sum" DataField="amount" HeaderText="Units in stock" 
                        FooterText="All units in stock: "
                    <telerik:GridCalculatedColumn HeaderText="Total Price" UniqueName="TotalPrice" DataType="System.Double" 
                        DataFields="price, amount" Expression="{0}*{1}" FooterText="Total : " Aggregate="Sum" /> 
            <ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true" /> 
        <asp:Button ID="Button1" Text="PostBack!" CssClass="button" Style="margin: 10px 22px 10px 0px" 
        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> 

1 Answer, 1 is accepted

Sort by
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,
the Telerik team

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