Template Item two questions

5 posts, 1 answers
  1. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 03 Jan 2010 Link to this post

    Dear all,

    I have a grid with TemplateItem contains table (without border set) with asp:textboxes to display data.

    Q1: how do I remove the grid normal columns header (inside the red box in the attached image)?
    Q2: the table is displaying a left and bottom lines around the controls, how can I remove them ?

    I checked that the RadFormDecorator doesn't cause this ...

    Thanks and best regards
    Waleed
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Jan 2010 Link to this post

    Hello Waleed,

    You can hide the headers for the grid in its ItemDataBound event as shown below:
    c#:
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
            if (e.Item is GridHeaderItem) 
            { 
                GridHeaderItem header = (GridHeaderItem)e.Item; 
                header.Display = false
            } 
        } 

    Happy New Year!
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 04 Jan 2010 Link to this post

    Hello Princy,

    Thanks, that's solve the first question.

    What about the thin border around the controls inside the table, I didn't express this behavior outside the template column.
    maybe it's the reason.

    I want to remove that border !!

    Thanks and Happy new year !!
    Waleed
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Jan 2010 Link to this post

    Hello Waleed,

    The table cells inside your template column may inherit border styles from RadGrid. Try adding the following CSS style  to get over this:
    css:
    .GridRow_[SkinName] td  td,  
    .GridAltRow_[SkinName]  td  td  
    {  
        border: 0;  
    }  

    or try using the ItemStyle-CssClass for the TemplateColumn as shown below:
    aspx:
    <telerik:GridTemplateColumn UniqueName="TemplateColumn"
       <ItemStyle  CssClass="Item" />  

    css:
    .Item  table  td  
       {  
         border: 0;  
       }  

    Thanks
    Princy.
  6. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 07 Jan 2010 Link to this post

    Hello Princy,

    I followed the second approach
    It isn't working for me, I don't know maybe I have something in-proper in my template item, look at my script:
    <ContentTemplate> 
        <telerik:RadGrid  
            ID="UserDetailsGrid" 
            runat="server" 
            AllowSorting="true" 
            AllowPaging="true" 
            PageSize="5" 
            OnNeedDataSource="UserDetailsGrid_NeedDataSource" 
            OnItemDataBound="UserDetailsGrid_ItemDataBound">  
            <MasterTableView Width="100%">  
                <ItemStyle CssClass="Item" /> 
                <ItemTemplate> 
                    <table id="parentTable" border="0" cellpadding="5">  
                        <tr> 
     
    this is part of it only, as you can see here I have a radDock with radGrid inside, I put the ItemStyle before the ItemTemplate as you can see.

    Best regards
    Waleed
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017