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

Remove blank spaces between rows

3 Answers 230 Views
Grid
This is a migrated thread and some comments may be shown as answers.
hokushin
Top achievements
Rank 1
hokushin asked on 19 Sep 2012, 01:35 PM
Hello!

I am trying to remove blank spaces between table rows by overriding embeded radgrid styles. All my efforts has so far been in vain so far. Any help will be very much appreciated!

<telerik:RadGrid ID="RadGrid1" runat="server" EnableTheming="false"   CssClass="myClass" AllowPaging="False" OnNeedDataSource="RadGrid1_NeedDataSource" BorderStyle="None" style="outline:none;" EnableEmbeddedSkins="false"
               >
                <MasterTableView DataKeyNames="ID" ShowHeader="false" ShowFooter="false" HierarchyDefaultExpanded="true" CommandItemDisplay="None" >
         <ItemTemplate>
         </ItemTemplate>
                                                 
                    <NestedViewTemplate>
                        <telerik:RadGrid ID="RadGrid2" runat="server" EnableTheming="false"  CssClass="myClass" EnableEmbeddedSkins="false" AllowPaging="False" OnNeedDataSource="RadGrid2_NeedDataSource" BorderStyle="None" OnItemDataBound="RadGrid2_ItemDataBound" style="outline:none;" >      
                         <MasterTableView ShowHeader="false" ShowFooter="false" ShowGroupFooter="false" HierarchyDefaultExpanded="false" CommandItemDisplay="None" >        
                        
         <ItemTemplate>
          
         <table style="font-size:11px; width:100%;border: .1em solid #000000;table-layout: fixed; padding-left: 0px;
    padding-right: 0px;">
      <tr>
            <td align="center" style="width:40px;border: .1em solid #000000;"">
               <asp:Label ID="lblRowNumber" runat="server" /></td>
            <td align="center" style="width:70px;border: .1em solid #000000;">
                  <%# DataBinder.Eval(Container.DataItem,"CreationDate") %></td>
            <td align="center" style="width:50px;border: .1em solid #000000;">
                  <%# DataBinder.Eval(Container.DataItem, "Number")%></td>
          
                <td align="center" style="width:150px;border: .1em solid #000000;">
                  <asp:Repeater ID="Repeater3" runat="server" DataSource='<%# Eval("Owners") %>'>
                                    <ItemTemplate>
                                        <%# DataBinder.Eval(Container.DataItem, "CertificateNumber")%>
                                        <%# DataBinder.Eval(Container.DataItem, "IssuedBy")%>
                                        <%# DataBinder.Eval(Container.DataItem, "WhenIssued")%>
                                        <%# DataBinder.Eval(Container.DataItem,"LegalObject")%>
                                        <%# DataBinder.Eval(Container.DataItem, "individual.FIO")%>
                                        <%# DataBinder.Eval(Container.DataItem, "legalEntity.Title")%>
                                        <%# DataBinder.Eval(Container.DataItem, "legalEntity.INN")%>
                                        <%# DataBinder.Eval(Container.DataItem, "legalEntity.OGRN")%>
                                        <%# DataBinder.Eval(Container.DataItem, "legalEntity.Address")%>
                                        <%# DataBinder.Eval(Container.DataItem, "legalEntity.LegalAddress")%>
                                    </ItemTemplate>
                                    <SeparatorTemplate>
                                        
                                    </SeparatorTemplate>
                                </asp:Repeater
                </td>           

        </tr>
 
               </table>
         </ItemTemplate>
 
                       </MasterTableView>   
                        
<ClientSettings EnableAlternatingItems="false">
 
<Selecting AllowRowSelect="False"/>
 
</ClientSettings>
                 
                        </telerik:RadGrid>
                    </NestedViewTemplate>                   
                </MasterTableView>
 
                 
<ClientSettings EnableAlternatingItems="false" Scrolling-AllowScroll="false"  >
 
<Selecting AllowRowSelect="False"/>
 
</ClientSettings>
 
 
            </telerik:RadGrid>

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 24 Sep 2012, 06:42 AM
Hi Hokushin,

Could you please try using the following code snippet and let me know if it helps you:
protected override void OnInit(EventArgs e)
{
     base.OnInit(e);
 
    RadGrid1.ItemCreated += RadGrid1_ItemCreated;
}
 
void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        (e.Item as GridDataItem).Attributes.Add("style", "display:none");
    }
}

Looking forward for your reply.

All the best,
Radoslav
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.
0
hokushin
Top achievements
Rank 1
answered on 24 Sep 2012, 10:03 AM
Hi Radoslav,

Thanks a lot for prompt reply, Firstly, I've applied the code for the nested RadGrid (RadGrid2). The app hasn't produced any output. Then I've applied the code for the parent RadGrid (RadGrid1). The app has produced much better output (I am attaching screenshot for your review) but the problem still exists...
0
Galin
Telerik team
answered on 27 Sep 2012, 10:42 AM
Hello Hokushin,

You should remove the padding and margin between the cells. You can achieve this by setting the table's attributes cellpadding and cellspacing to "0", or by using the following CSS rule
.RadGrid .rgMasterTable,
.RadGrid .rgDetailTable,
.RadGrid table
{
    border-spacing: 0;
}
 
.RadGrid table td
{
    padding: 0;
}

I hope this helps.





All the best,
Galin
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.
Tags
Grid
Asked by
hokushin
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
hokushin
Top achievements
Rank 1
Galin
Telerik team
Share this question
or