Multiple RadGrids inside of a TabStrip Rendering Issue

2 posts, 0 answers
  1. Doug
    Doug avatar
    7 posts
    Member since:
    Mar 2009

    Posted 06 May 2009 Link to this post

    I have a user control which has a 4-tab tab strip inside.  Each of those tabs in turn render child user controls.  In two of those child controls I have a RadGrid.  I am having a lot of rendering issues with those grids inside the child controls that I do not have elsewhere in the application (I am using the grid extensively to replace an Access application and I have the grid pretty much down and many times copy and paste one set of grid code to another with very few changes).  Some notes:

    1.  I use static headers on all the grids
    2.  I define each column in the grid as well as explicitly define widths
    3.  I use all the resizing and re-ordering bells and whistles

    The grids inside the tabstrip/multipage render horribly.  Margins are off, title columns are not aligned with data columns, reordering one column in one grid throws off the margins of the other grid in the other tab, etc.  The strange this is that it is random and intermittent.  One time I load the page everything will look fine.  Refresh the page and everything could be off.  Close the browser and reload the app, everything could be off.  Refresh the page again and it looks fine.  I am using IE6 as per our corporate standards and am binding the data using NeedDataSource with a LINQ to SQL stored procedure.  I cannot give out data details, but snippets of code showing the basic configuration is below.  I don't seem to have this problem except for when I place a grid inside a tabstrip.  Any help would be appreciated.

    Thanks,
    Doug

    Parent Control Code:

    1 <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MappingTables.ascx.cs" Inherits="LEBrowser.Content.Controls.WorkPanel.MappingTables" %> 
    2 <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
    3 <%@ Register src="/Content/Controls/Tabs/AddressTypes.ascx" tagname="AddressTypes" tagprefix="VZW" %> 
    4 <%@ Register src="/Content/Controls/Tabs/ContactTypes.ascx" tagname="ContactTypes" tagprefix="VZW" %> 
    5 <%@ Register src="/Content/Controls/Tabs/LegalEntityTypes.ascx" tagname="LegalEntityTypes" tagprefix="VZW" %> 
    6 <%@ Register src="/Content/Controls/Tabs/PhoneFaxTypes.ascx" tagname="PhoneFaxTypes" tagprefix="VZW" %> 
    7  
    8 <table width="100%">  
    9     <tr> 
    10         <td width="30%" align="left" valign="middle">  
    11             <span class="WorkPanelTitle">  
    12                 <asp:Literal runat="server" ID="litMappingTablesTitle">  
    13                     Mapping Tables  
    14                 </asp:Literal> 
    15             </span>               
    16         </td> 
    17     </tr> 
    18 </table> 
    19 <asp:Image ID="imgDivider" AlternateText="Work Panel Divider" ImageUrl="~/Content/Images/WorkPanelDivider.png" runat="server" /> 
    20 <telerik:RadTabStrip ID="tabMappingTables" runat="server" Width="100%"   
    21     ShowBaseLine="True" ReorderTabsOnSelect="True" MultiPageID="mpMappingTables">  
    22     <Tabs> 
    23         <telerik:RadTab runat="server" Text="Address Types" Selected="true">  
    24         </telerik:RadTab> 
    25         <telerik:RadTab runat="server" Text="Contact Types">  
    26         </telerik:RadTab> 
    27         <telerik:RadTab runat="server" Text="Legal Entity Types">  
    28         </telerik:RadTab> 
    29         <telerik:RadTab runat="server" Text="Phone/Fax Types">  
    30         </telerik:RadTab> 
    31     </Tabs> 
    32 </telerik:RadTabStrip> 
    33 <telerik:RadMultiPage ID="mpMappingTables" runat="server" SelectedIndex="0">  
    34     <telerik:RadPageView ID="pvAddressTypes" runat="server">  
    35         <VZW:AddressTypes ID="vzwAddressTypes" runat="server" /> 
    36     </telerik:RadPageView> 
    37     <telerik:RadPageView ID="pvContactTypes" runat="server">  
    38         <VZW:ContactTypes ID="vzwContactTypes" runat="server" /> 
    39     </telerik:RadPageView> 
    40     <telerik:RadPageView ID="pvLegalEntityTypes" runat="server">  
    41         <VZW:LegalEntityTypes ID="vzwLegalEntityTypes" runat="server" /> 
    42     </telerik:RadPageView> 
    43     <telerik:RadPageView ID="pvPhoneFaxTypes" runat="server">  
    44         <VZW:PhoneFaxTypes ID="vzwPhoneFaxTypes" runat="server" /> 
    45     </telerik:RadPageView> 
    46 </telerik:RadMultiPage> 
    47  

    Child control example (Address Type)

    1 <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddressTypes.ascx.cs" Inherits="LEBrowser.Content.Controls.Tabs.AddressTypes" %> 
    2 <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
    3 <br /> 
    4 <div class="Center">  
    5     <span class="WorkWindowMessage">  
    6         <asp:Label ID="lblAddressTypesMessage" runat="server">&nbsp;</asp:Label> 
    7     </span> 
    8 </div> 
    9 <div class="Grid">  
    10   <telerik:RadGrid ID="gridAddressTypes" runat="server" GridLines="None" AllowPaging="True" AllowFilteringByColumn="True" 
    11       AllowSorting="True" AutoGenerateColumns="False" ShowStatusBar="true" OnPreRender="gridAddressTypes_PreRender" 
    12       OnNeedDataSource="gridAddressTypes_NeedDataSource" OnUpdateCommand="gridAddressTypes_UpdateCommand" 
    13       OnInsertCommand="gridAddressTypes_InsertCommand" OnDeleteCommand="gridAddressTypes_DeleteCommand" 
    14       OnCancelCommand="gridAddressTypes_CancelCommand" Width="850" Height="400">  
    15       <MasterTableView CommandItemDisplay="Top" DataKeyNames="MappingTableID">  
    16           <CommandItemSettings AddNewRecordText="Add New Address Type" /> 
    17           <Columns> 
    18                         <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">  
    19                             <ItemStyle Width="30" /> 
    20             </telerik:GridEditCommandColumn> 
    21             <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete" 
    22                             ConfirmDialogType="RadWindow" ConfirmTitle="Confirm Address Type Delete" 
    23                             ConfirmText="Are You Sure You Want To Delete This Address Type?  This will also delete any items associated with this Address Type!">  
    24                             <ItemStyle Width="30" /> 
    25                         </telerik:GridButtonColumn> 
    26             <telerik:GridBoundColumn UniqueName="ShortDescription" HeaderText="Short Description" DataField="ShortDescription">  
    27                             <ItemStyle Width="125" /> 
    28             </telerik:GridBoundColumn> 
    29             <telerik:GridBoundColumn UniqueName="Description" HeaderText="Description" DataField="Description">  
    30                             <ItemStyle Width="420" /> 
    31             </telerik:GridBoundColumn> 
    32             <telerik:GridBoundColumn UniqueName="IsActive" HeaderText="Active" DataField="IsActive">  
    33                             <ItemStyle Width="98" /> 
    34             </telerik:GridBoundColumn> 
    35           </Columns> 
    36           <EditFormSettings UserControlName="~/Content/Controls/GridForm/AddressType.ascx" EditFormType="WebUserControl">  
    37                         <EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
    38                         <FormStyle BackColor="White" /> 
    39           </EditFormSettings> 
    40       </MasterTableView> 
    41       <clientsettings AllowColumnsReorder="True">  
    42                 <scrolling allowscroll="True" usestaticheaders="True" /> 
    43                 <Resizing AllowColumnResize="True" EnableRealTimeResize="True" /> 
    44             </clientsettings> 
    45   </telerik:RadGrid> 
    46 </div> 
    1 using System;  
    2 using System.Web.UI;  
    3 using System.Web.UI.WebControls;  
    4 using Telerik.Web.UI;  
    5 using VZWTaxAPICoreLibrary.Managers;  
    6 using VZWTaxAPICoreLibrary.Objects.Generic;  
    7 using VZWTaxAPICoreLibrary.Objects.Security;  
    8  
    9 namespace LEBrowser.Content.Controls.Tabs  
    10 {  
    11     public partial class AddressTypes : UserControl  
    12     {  
    13         private readonly MappingManager MappingManager = new MappingManager();  
    14         private User SessionUser;  
    15  
    16         protected void Page_Load(object sender, EventArgs e)  
    17         {  
    18             SessionUser = Global.GetSessionUser(Session.SessionID);  
    19         }  
    20  
    21         protected void gridAddressTypes_PreRender(object sender, EventArgs e)  
    22         {  
    23             if (!IsPostBack)  
    24             {  
    25                 gridAddressTypes.MasterTableView.Items[1].Edit = true;  
    26                 gridAddressTypes.MasterTableView.Rebind();  
    27             }  
    28         }  
    29  
    30         protected void gridAddressTypes_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)  
    31         {  
    32             gridAddressTypes.DataSource = MappingManager.GetAddressTypes();  
    33         }  
    34  
    35         protected void gridAddressTypes_InsertCommand(object sender, GridCommandEventArgs e)  
    36         {  
    37             UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);  
    38             MappingTable newMappingTable = new MappingTable  
    39                                             {  
    40                                                 ShortDescription = (userControl.FindControl("txtShortDescription"as TextBox).Text,  
    41                                                 Description = (userControl.FindControl("txtDescription"as TextBox).Text,  
    42                                                                                 IsActive = (userControl.FindControl("chkIsActive"as CheckBox).Checked  
    43                                             };  
    44  
    45             if (!MappingManager.CheckDuplicateAddressType(newMappingTable))  
    46             {  
    47                 MappingManager.InsertAddressType(newMappingTable, SessionUser.UserID);  
    48                 lblAddressTypesMessage.Text = "Address Type Successfully Added!";  
    49             }  
    50             else 
    51             {  
    52                 e.Canceled = true;  
    53                 lblAddressTypesMessage.Text = "An Address Type With The Same Identifier Already Exists!";  
    54             }  
    55         }  
    56  
    57         protected void gridAddressTypes_UpdateCommand(object sender, GridCommandEventArgs e)  
    58         {  
    59             UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);  
    60             MappingTable updateMappingTable = new MappingTable  
    61                                                 {  
    62                                                     MappingTableID =  
    63                                                         Convert.ToInt32((userControl.FindControl("txtAddressTypeID"as TextBox).Text),  
    64                                                     ShortDescription =  
    65                                                         (userControl.FindControl("txtShortDescription"as TextBox).Text,  
    66                                                     Description = (userControl.FindControl("txtDescription"as TextBox).Text,  
    67                                                                                         IsActive = (userControl.FindControl("chkIsActive"as CheckBox).Checked,  
    68                                                                                     };  
    69  
    70             MappingManager.UpdateAddressType(updateMappingTable, SessionUser.UserID);  
    71             lblAddressTypesMessage.Text = "Address Type Successfully Updated!";  
    72         }  
    73  
    74         protected void gridAddressTypes_DeleteCommand(object sender, GridCommandEventArgs e)  
    75         {  
    76             string sAddressTypeID = (e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["MappingTableID"].ToString();  
    77             MappingManager.DeleteAddressType(Convert.ToInt32(sAddressTypeID), SessionUser.UserID);  
    78         }  
    79  
    80         protected void gridAddressTypes_CancelCommand(object sender, GridCommandEventArgs e)  
    81         {  
    82             lblAddressTypesMessage.Text = "&nbsp;";  
    83         }  
    84     }  
    85
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 11 May 2009 Link to this post

    Hello Doug,

    I carefully examined your code snippet and I could not find something erroneous in the posted code. I will suggest you to examine this online demo which covers the required functionality. Note that every page view is loaded with Ajax request in order to avoid loading big amount of HTML mark-up code. Thus the performance is increased.

    For further information you can review this online help article.

    If the problem still persists I will suggest you to create a test project which reproduces the described erroneous behavior and attach it to a regular support thread.

    Regards,
    Georgi Krustev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top