Radgrid colspan override

4 posts, 0 answers
  1. Sachin
    Sachin avatar
    2 posts
    Member since:
    Jul 2012

    Posted 25 Jul 2012 Link to this post

    Hi,

    I am working with Telerik version 2011.1.519.35. I am using hierarchical radgrid. Markup is something like this,

    <telerik:RadGrid ID="gridOrder" runat="server" AllowPaging="True" AllowSorting="True"
                    AllowCustomPaging="True" GridLines="None" Skin="radGridSkin" EnableEmbeddedSkins="false"
                    ShowGroupPanel="True" EnableHeaderContextMenu="True" Width="100%" Height="100%"
                    AllowMultiRowSelection="True" AutoGenerateColumns="false" OnNeedDataSource="gridOrder_NeedDataSource"
                    OnItemDataBound="gridOrder_ItemDataBound" DisplayDataKey="ORDER_NUMBER" OnPreRender="gridOrder_PreRender"
                    OnPageSizeChanged="gridOrder_PageSizeChanged" OnItemCommand="gridOrder_ItemCommand"
                    OnItemCreated="gridOrder_ItemCreated" OnGroupsChanging="gridOrder_GroupsChanging"
                    OnPageIndexChanged="gridOrder_PageIndexChanged" PageSize="20">
                    <ExportSettings IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="true">
                        <Excel Format="ExcelML" />
                    </ExportSettings>
                    <MasterTableView GroupLoadMode="Client" DataKeyNames="ORDER_NUMBER" Name="ORDER"
                        ClientDataKeyNames="ORDER_NUMBER,CAN_SUPPLIER_ORDER_PRODUCT,SUPPLIER_ID,STATE,O_ORGANIZATION_ID"
                        UseAllDataFields="true">
                        <RowIndicatorColumn Visible="true">
                        </RowIndicatorColumn>
                        <NestedViewTemplate>
                            <div class="order-line-wrapper">
                                <telerik:RadTabStrip MultiPageID="radMultiPageOrderDetail" SelectedIndex="0" ID="RadOrderDetailTabStrip"
                                    runat="server" Skin="radTabStripSkin" EnableEmbeddedSkins="false" ScrollChildren="true">
                                    <Tabs>
                                        <telerik:RadTab Text="Order Detail" Selected="True" Value="tabOrderDetail" PageViewID="pageOrderDetail">
                                        </telerik:RadTab>
                                        <telerik:RadTab Text="Order Workflow State History" Value="tabOrderWorkflowHistory"
                                            PageViewID="pageOrderWorkflowHistory">
                                        </telerik:RadTab>
                                    </Tabs>
                                </telerik:RadTabStrip>
                                <telerik:RadMultiPage SelectedIndex="0" ID="radMultiPageOrderDetail" runat="server">
                                    <telerik:RadPageView runat="server" ID="pageOrderDetail" Selected="True">
                                        <div class="order-line-border order-line-control">
                                            <calvi:OrderLineControl Visible="false" ID="OrderLineCtrl" runat="server" PageCookieEntityName="ORDER_MAIN_FORM">
                                            </calvi:OrderLineControl>
                                        </div>
                                    </telerik:RadPageView>
                                    <telerik:RadPageView runat="server" ID="pageOrderWorkflowHistory">
                                        <div class="order-line-border order-line-control">
                                            <calvi:OrderWorkflowHistoryControl ID="OrderWorkflowHistoryControl" runat="server"
                                                ShowLoadingPanel="false" PageCookieEntityName="OrderMain_WorkflowHistory" />
                                        </div>
                                    </telerik:RadPageView>
                                </telerik:RadMultiPage>
                            </div>
                        </NestedViewTemplate>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True"
                            UniqueName="ExpandColumn">
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridBoundColumn DataField="DEBTOR_REFERENCE" FilterControlAltText="Filter DEBTOR_REFERENCE column"
                                HtmlEncode="true" DataFormatString="<nobr>{0}&nbsp;</nobr>" HeaderText="DEBTOR_REFERENCE"
                                SortExpression="DEBTOR_REFERENCE" UniqueName="DEBTOR_REFERENCE">
                            </telerik:GridBoundColumn>...
    OrderLineControl and OrderWorkflowHistoryControl usercontrols contain radgrid. What I need is to utilize the available 
    space on expansion. For example if the parent grid has 12 visible columns then the child grid on expansion should also occupy
    12 colspan. However since we have provided the column choosing option on clientside and set Display property of each hidden
    column to false, if the column is not selected to be visible, the grid is not able to set the colspan in accordance with the
    visible column.
    
    Hence to workaround the problem I am executing following peace of code on grid ItemCreated event,
    
    (e.Item as GridNestedViewItem).NestedViewCell.Attributes["colSpan"] = {string value of number of visible columns}
    
    The above code works fine in IE7 & IE9, however it fails in IE8 (please refer the attached images). 
    
    Could you please help me with this.
    
    Regards,
    
    Sachin
    
     
     
  2. Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 30 Jul 2012 Link to this post

    Hello Sachin,

    Modifying the RadGrid colspan would not be the best approach in this case if the sole purpose is to get the grid to fit the available space. As you can see in this demo, it is enough to have Width="100%" for the grid and all GridTableViews (including the MasterTableView) and TableLayout="Auto" for the grid to get it to fit the available space even when its columns are hidden:
    http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/headercontextmenu/defaultcs.aspx

    Is this not the same as your requirement?

    Regards,
    Tsvetina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Sachin
    Sachin avatar
    2 posts
    Member since:
    Jul 2012

    Posted 17 Aug 2012 Link to this post

    Hello Tsvetina,

    Thank you for your response and apologizes for delay in responding. 

    I had tried earlier the suggestion that you have mentioned, however it did not work in my case. But I managed figure out where the problem was in my code and fixed it. Now it works like a charm.

    Thank you for your response,

    Sachin


  4. Ufuk
    Ufuk avatar
    1 posts
    Member since:
    Aug 2008

    Posted 24 Nov 2015 in reply to Sachin Link to this post

    Hello Sachin,

     I have exactly the same problem with you. Could you explain how did you fix in your case?

     Thanks,

     Ufuk

Back to Top