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

RadGrid resize issue in IE8

4 Answers 28 Views
Grid
This is a migrated thread and some comments may be shown as answers.
natasha
Top achievements
Rank 1
natasha asked on 28 Nov 2011, 03:58 PM
Hello.
I have a rad grid with the Header Context Menu enabled.
When I hide a column by deselecting it in the Header Context Menu, the rad grid does not re size correctly in IE8. White space appears at the end of the screen in place of the hidden column.
In IE9 the rad grid re sizes correctly.

My aspx code is:

<%@ Page Language="c#" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head runat="server">
  <title>Test</title>
</head>
<body>
  <form runat="server" id="Form1" method="post">
  <telerik:RadScriptManager ID="RadScriptManager" runat="server" />
  <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
      <telerik:AjaxSetting AjaxControlID="RadGrid1">
        <UpdatedControls>
          <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
      </telerik:AjaxSetting>
    </AjaxSettings>
  </telerik:RadAjaxManager>
  <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
  <telerik:RadGrid runat="server" ID="RadGrid1" AllowFilteringByColumn="True" DataSourceID="SqlDataSource1"
    AllowSorting="True" ShowGroupPanel="True" AutoGenerateColumns="true" EnableHeaderContextMenu="True"
    GridLines="None">
    <MasterTableView FilterItemStyle-Wrap="true" FilterItemStyle-HorizontalAlign="Left"
      CommandItemDisplay="Top">
    </MasterTableView>
    <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True"
      AllowGroupExpandCollapse="true" AllowColumnHide="true" ColumnsReorderMethod="Reorder">
      <Resizing AllowColumnResize="true" EnableRealTimeResize="true" ResizeGridOnColumnResize="true">
      </Resizing>
    </ClientSettings>
    <GroupingSettings ShowUnGroupButton="true" />
    <HeaderStyle Width="150px" Wrap="true" />
  </telerik:RadGrid>
  <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT TOP 10 CustomerID, CompanyName, ContactName, ContactTitle, Address, PostalCode FROM Customers"
    runat="server" />
  </form>
</body>
</html>

Thank you 
Natasha

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 29 Nov 2011, 10:05 AM
Hello Natasha,

Check the following forum thread which discussed similar scenario.
Remove white space at end of Column while resize

-Shinu
0
Vishu
Top achievements
Rank 1
answered on 25 Jul 2014, 08:15 PM
HI,
         Facing context menu misalignment issue on IE when I re-size my column to very long length. I tried to right+click on one column header but the context menu opens on another column which is too far from the clicked column header. (**Attached screenshot**)


Aspx Code:
<telerik:RadGrid ID="gridItemsSearch" runat="server" PageSize="19" AllowPaging="true" HeaderStyle-Font-Underline="true" AllowCustomPaging="true" OnPageIndexChanged="gridItemsSearch_PageIndexChanged" 
                             AutoGenerateColumns="False" Skin="Office2007" OnItemCommand="gridItemsSearch_OnItemCommand" Visible="true" OnSortCommand="gridItemsSearch_SortCommand" EnableHeaderContextMenu="true" 
                            OnNeedDataSource="gridItemsSearch_NeedDataSource" ExportSettings-FileName="ItemParts" OnItemDataBound="gridItemsSearch_ItemDataBound" Width="100%"
                            OnPreRender="gridItemsSearch_PreRender"  AllowSorting="true" CellPadding="2" ShowFooter="false" ExportSettings-ExportOnlyData="false">                            
                            <PagerStyle Mode="NextPrevAndNumeric" Position="Top" ></PagerStyle>
                            <MasterTableView ShowHeadersWhenNoRecords="true" AllowSorting="true" AllowMultiColumnSorting="false" AllowNaturalSort="true" UseAllDataFields="false" ItemStyle-Height="5px" EnableColumnsViewState="true" TableLayout="Fixed" 
                                DataKeyNames="ItemNumber" Width="100%">                                
                                <Columns>                                   
                                    <telerik:GridTemplateColumn SortExpression="ItemNumber" DataField="ItemNumber" HeaderText=""
                                        UniqueName="ChkItemNumber" HeaderStyle-Width="30px">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="imgpickItem" runat="server" ToolTip="Click to add to Kit Contents" ImageUrl="~/images/basket_add.png" 
                                                CommandName="Select" />
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                     <telerik:GridTemplateColumn HeaderText="#" UniqueName="RowNumber" Visible="false">
                                        <ItemTemplate>
                                            <asp:Label runat="server" ID="lblRowNumber" Width="50px" Text='<%# Container.DataSetIndex+1 %>'></asp:Label>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <%-- Newly Added columns are following --%>
                                     <telerik:GridBoundColumn DataField="Branch" HeaderText="Branch" SortExpression="Branch" HeaderStyle-Width="70px"
                                        UniqueName="BranchId" ItemStyle-HorizontalAlign="Left" />
                                     <telerik:GridBoundColumn DataField="BranchDesc" HeaderText="Branch Description" SortExpression="BranchDesc" HeaderStyle-Width="90px"
                                        UniqueName="BranchName" ItemStyle-HorizontalAlign="Left"/>
                                    <%-- Newly added columns adding ends --%>
                                    <telerik:GridBoundColumn DataField="ItemNumber" HeaderText="Item ID" HeaderStyle-Width="45px"
                                        UniqueName="ItemNumber" ItemStyle-HorizontalAlign="Left" SortExpression="ItemNumber"/>                                   
                                    <telerik:GridBoundColumn DataField="ItemDescription" HeaderText="Item Description" UniqueName="ItemDescription" HeaderStyle-Width="90px"
                                        ItemStyle-HorizontalAlign="Left" SortExpression="ItemDescription" />
                                    <telerik:GridBoundColumn DataField="Group" UniqueName="Group" Visible="false" />
                                    <telerik:GridBoundColumn DataField="Available" HeaderText="Available"  SortExpression="Available" DataType="System.Double" HeaderStyle-Width="90px"
                                        ItemStyle-HorizontalAlign="Center" UniqueName="Available" />
                                    
                                    <telerik:GridBoundColumn DataField="READYFORRENT_QTY" HeaderText="Assets Ready for Rent"  DataType="System.Double" HeaderStyle-Width="70px"
                                        ItemStyle-HorizontalAlign="Center" UniqueName="READYFORRENT_QTY" SortExpression="READYFORRENT_QTY" />
                                    
                                    <telerik:GridBoundColumn DataField="Allocated" HeaderText="Allocated" SortExpression="Allocated" HeaderStyle-Width="90px"
                                        ItemStyle-HorizontalAlign="Center" UniqueName="Allocated" Visible="false"/>
                                    
                                    <telerik:GridTemplateColumn DataField="Allocated" HeaderText="Allocated" UniqueName="AllocatedPopup" SortExpression="Allocated"  ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="70px">
                                        <ItemTemplate>                                                        
                                            <asp:LinkButton ToolTip="Allocated Quantity" runat="server" ID="lnkSelectAllocated" OnClick="BtnSelectItemAllocationData_Click" Visible="true" Text='<%# Eval("Allocated") %>' />
                                            <asp:Label ID="lblAllocated" runat="server" Visible="false" Text='<%# Eval("Allocated") %>' />
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>                                   

                                     <telerik:GridTemplateColumn DataField="QtyOnHand" HeaderText="On Hand" UniqueName="OnHand"  ItemStyle-HorizontalAlign="Center" SortExpression="QtyOnHand" HeaderStyle-Width="70px">
                                        <ItemTemplate>
                                                <asp:LinkButton Text='<%# Eval("QtyOnHand") %>' runat="server"  ID="BtnSelectItemLocation" OnClick="BtnSelectItemLocation_Click" Visible="true" ToolTip="Click to see item storage location"/>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>

                                    <telerik:GridBoundColumn DataField="OnOrder" HeaderText="On Order"  SortExpression="OnOrder" HeaderStyle-Width="70px"
                                        ItemStyle-HorizontalAlign="Center" UniqueName="OnOrder" />
                                     <telerik:GridBoundColumn DataField="AverageCost" HeaderText="Average Cost" DataType="System.Double" DefaultInsertValue="0.0" HeaderStyle-Width="70px"
                                        ItemStyle-HorizontalAlign="Center" UniqueName="AverageCost" SortExpression="AverageCostActualValue"/>
                                     <telerik:GridBoundColumn DataField="SixMonthUsage" HeaderText="6 Month Usage" SortExpression="SixMonthUsage" HeaderStyle-Width="90px"
                                        ItemStyle-HorizontalAlign="Center" UniqueName="SixMonthUsage"/>

                                      <telerik:GridTemplateColumn DataField="TwelveMonthUsage" HeaderText="12 Month Usage" UniqueName="TwelveMonthUsage" SortExpression="TwelveMonthUsage" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="70px">
                                        <ItemTemplate>                                                        
                                            <asp:LinkButton ToolTip="12 Month Usage" runat="server" ID="lnkSelect12MonUsage" OnClick="BtnSelectItem12MonUsage_Click" Visible="true" Text='<%# Eval("TwelveMonthUsage") %>' />
                                            <asp:Label ID="lbl12MonUsage" runat="server" Visible="false" Text='<%# Eval("TwelveMonthUsage") %>' />
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>                                      

                                    <telerik:GridBoundColumn DataField="UnitOfMeasure" HeaderText="Standard UOM" HeaderStyle-Width="90px"
                                        ItemStyle-HorizontalAlign="Left" UniqueName="UnitOfMeasure" SortExpression="UnitOfMeasure" />
                                                                 
                                     <telerik:GridTemplateColumn DataField="VendorName" HeaderText="Preferred Vendor" UniqueName="VendorName" ItemStyle-HorizontalAlign="Left" SortExpression="VendorName" HeaderStyle-Width="90px" >
                                        <ItemTemplate>
                                             <asp:LinkButton ToolTip="Click to see additional vendors" runat="server" ID="BtnSelectVendor" OnClick="BtnSelectVendor_Click" Visible="true" Text='<%# Eval("VendorName") != "" ? Eval("VendorName") : "" %>' />                                             
                                        </ItemTemplate>
                                      </telerik:GridTemplateColumn>

                                     <telerik:GridBoundColumn DataField="OEMPartNo" HeaderText="OEM Part #" UniqueName="OEMPart" SortExpression="OEMPartNo" HeaderStyle-Width="70px"
                                        ItemStyle-HorizontalAlign="Left" />
                                                                  
                                      <telerik:GridTemplateColumn DataField="OEM" HeaderText="OEM" UniqueName="OEM" ItemStyle-HorizontalAlign="Center" SortExpression="OEM" HeaderStyle-Width="90px">
                                        <ItemTemplate>
                                                <asp:LinkButton ToolTip="Click to see additional manufacturers" runat="server" ID="BtnSelectItemOEMData" OnClick="BtnSelectItemOEMData_Click" Visible="true" Text='<%# Eval("OEM") != "" ? Eval("OEM") : "" %>'  />                                                 
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>                                     
                                                                   
                                    <telerik:GridBoundColumn DataField="ReorderPoint" HeaderText="Reorder Point" HeaderStyle-Width="70px"
                                        ItemStyle-HorizontalAlign="Center" UniqueName="ReorderPoint" SortExpression="ReorderPoint" />                                                                   
                                   
                                     <telerik:GridTemplateColumn HeaderText="Critical Item" ItemStyle-HorizontalAlign="Center" UniqueName="CriticalItem" SortExpression="CriticalItem" HeaderStyle-Width="70px">
                                        <ItemTemplate>
                                                <asp:CheckBox ID="BtnSelectCriticalItem" runat="server" Enabled="false"  Checked='<%# Eval("CriticalItem").ToString()  == "Y" ? true : false %>' />
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>

                                     <telerik:GridBoundColumn DataField="VRMSFullCode" HeaderText="VMRS Code"  SortExpression="VRMSFullCode" HeaderStyle-Width="70px"
                                        ItemStyle-HorizontalAlign="Left" UniqueName="VRMSFullCode"/>
                                    <telerik:GridBoundColumn DataField="IsPMKitItem" HeaderText="PM Kit"  SortExpression="IsPMKitItem" Visible="false" HeaderStyle-Width="70px"
                                        ItemStyle-HorizontalAlign="Left" UniqueName="IsPMKitItem"/>
                                     <telerik:GridBoundColumn DataField="CoreValue" HeaderText="Core Value"  HeaderStyle-Width="70px"
                                        ItemStyle-HorizontalAlign="Left" UniqueName="CoreValue" SortExpression="CoreValue" />
                                     <telerik:GridTemplateColumn DataField="PrintBarCode" HeaderText="Print Barcode" UniqueName="PrintbarcodeLinkLevel1" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="40px">                                     
                                        <ItemTemplate>                                                                
                                            <asp:ImageButton ID="PrintbarcodeLinkInventory" runat="server"  ImageUrl="~/Images/Print.png" ToolTip="Print Barcode"/>
                                        </ItemTemplate>
                                     </telerik:GridTemplateColumn>  
                                                                        
                                    <telerik:GridBoundColumn DataField="Family" HeaderText="Family" SortExpression="Family" Visible="false" 
                                        ItemStyle-HorizontalAlign="Left" UniqueName="Family"/>
                                    <telerik:GridBoundColumn DataField="Category" HeaderText="Category" SortExpression="Category" Visible="false"
                                        ItemStyle-HorizontalAlign="Left" UniqueName="Category"/>
                                    <telerik:GridBoundColumn DataField="Group" HeaderText="Group" SortExpression="Group" Visible="false"
                                        ItemStyle-HorizontalAlign="Left" UniqueName="Group"/> 
                                                                                                               
                                      <telerik:GridBoundColumn DataField="StorageArea" HeaderText="Storage Area" Visible="false"
                                        UniqueName="StorageArea" ItemStyle-HorizontalAlign="Left" SortExpression="StorageArea" />
                                      <telerik:GridBoundColumn DataField="IsInventoryItem" HeaderText="Inventory Item" Visible="false"
                                        UniqueName="IsInventoryItem" ItemStyle-HorizontalAlign="Left" SortExpression="IsInventoryItem" />   
                                    <telerik:GridBoundColumn DataField="AverageCostActualValue" HeaderText="Avg Cose" Visible="false" 
                                        UniqueName="AverageCostActualValue" ItemStyle-HorizontalAlign="Left" SortExpression="AverageCostActualValue" DataType="System.Decimal"/>    
                                    <telerik:GridBoundColumn DataField="Parent" HeaderText="Parent" Visible="false" 
                                        UniqueName="Parent" ItemStyle-HorizontalAlign="Left" SortExpression="Parent"/>    
                                    <telerik:GridBoundColumn DataField="Child1" HeaderText="Child1" Visible="false" 
                                        UniqueName="Child1" ItemStyle-HorizontalAlign="Left" SortExpression="Child1"/>    
                                    <telerik:GridBoundColumn DataField="Child2" HeaderText="Child2" Visible="false" 
                                        UniqueName="Child2" ItemStyle-HorizontalAlign="Left" SortExpression="Child2"/>    
                                    <telerik:GridBoundColumn DataField="Child3" HeaderText="Child3" Visible="false" 
                                        UniqueName="Child3" ItemStyle-HorizontalAlign="Left" SortExpression="Child3"/>
                                     <telerik:GridBoundColumn DataField="UltimateParent" HeaderText="UltimateParent" Visible="false" 
                                        UniqueName="UltimateParent" ItemStyle-HorizontalAlign="Left" SortExpression="UltimateParent"/>                                                                      
                                </Columns>
                            </MasterTableView>
                            <SortingSettings EnableSkinSortStyles="false" />
                             <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" ColumnsReorderMethod="Reorder">                                 
                                <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="true"
                                    ClipCellContentOnResize="true" EnableRealTimeResize="false" AllowResizeToFit="true" />
                                 <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="500px" SaveScrollPosition="true" />
                                 <ClientEvents OnColumnClick="GridSortProcessingText" OnCommand="GridCommand" /> 
                                 <ClientMessages DragToGroupOrReorder="Drag to reorder" />    
                                 <Selecting AllowRowSelect="True" />      
                                 <ClientEvents  />                                                                                         
                                                                                                                 
                            </ClientSettings>
                        </telerik:RadGrid>

ASPX.CS CODE:
private void SetColumnOrderIndex(string resources)
        {
            Dictionary<string, int> dictionaryOrder = new Dictionary<string, int>();
            Dictionary<string, int> dictionaryWidth = new Dictionary<string, int>();
            Dictionary<string, bool> dictionaryVisible = new Dictionary<string, bool>();
            XDocument doc;
            if (!string.IsNullOrWhiteSpace(resources))
            {
                doc = XDocument.Parse(resources);
                foreach (XElement element in doc.Descendants("order"))
                {                    
                    foreach (XElement childEllement in element.DescendantNodesAndSelf())
                    {
                        dictionaryOrder[childEllement.Attribute("columnname").Value] = Convert.ToInt16(childEllement.Attribute("columnorder").Value);
                        dictionaryWidth[childEllement.Attribute("columnname").Value] = childEllement.Attribute("columnwidth") != null ? Convert.ToInt16(childEllement.Attribute("columnwidth").Value):0;                        
                        if (childEllement.Attribute("columnvisible") != null)
                            dictionaryVisible[childEllement.Attribute("columnname").Value] = Convert.ToBoolean(childEllement.Attribute("columnvisible").Value);                        
                    }
                }
                foreach (GridColumn col in gridItemsSearch.Columns)
                {
                    foreach (string key in dictionaryOrder.Keys)
                    {
                        if (key == col.UniqueName)
                        {
                            col.OrderIndex = dictionaryOrder[key];
                            break;
                        }
                    }
                    foreach (string key in dictionaryWidth.Keys)
                    {
                        if (key == col.UniqueName)
                        {
                             if (Convert.ToInt16(dictionaryWidth[key]) > 0)
                             { 
                                col.HeaderStyle.Width =  dictionaryWidth[key];
                                break;
                             }
                        }
                    }
                    foreach (string key in dictionaryVisible.Keys)
                    {
                        if (key == col.UniqueName)
                        {
                            col.Display = dictionaryVisible[key];
                            break;
                        }
                    }

                }
            }            
        }










0
Vishu
Top achievements
Rank 1
answered on 29 Jul 2014, 01:22 PM
Admin,
           Any updates on this context menu issue? Would appreciate if someone could let me know whether this issue is fixed in 2014 Q1 ver. 
0
Galin
Telerik team
answered on 30 Jul 2014, 02:44 PM
Hello Vishu,

I tried to replicate the issue which you described, but to no avail. I tried with version 2011.3 1115 and all supported browsers. Attached to this message, you will find the code which I used for testing.
Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.

Regards,
Galin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
natasha
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Vishu
Top achievements
Rank 1
Galin
Telerik team
Share this question
or