C1GridView ItemStyle CSS Padding not working

Posted by: mitesh76 on 10 September 2017, 11:34 am EST

  • Posted 10 September 2017, 11:34 am EST

    I have a C1GridView as follows:


    <cc1:C1GridView ID="C1GridView1" runat="server" AllowPaging="True" PageSize="20" AutoGenerateColumns="False" VisualStylePath="~/C1WebControls/VisualStyles" DataSourceID="SqlDataSource1" Width="100%" CellPadding="2" CellSpacing="0">


     <Columns>


     <cc1:C1HyperLinkField DataNavigateUrlField="ordID" DataNavigateUrlFormatString="order.aspx?id={0}" DataTextField="ordID" HeaderText="Order Id">


    <HeaderStyle CssClass="C1GridView_ColumnHeader" />


    <ItemStyle CssClass="C1GridView_Item" />


     </cc1:C1HyperLinkField


     


    .... and so on.


    As can be seen I have applied a CSS class on each column on the columns ItemStyle property. The class is called 'C1GridView_Item'. The CSS code for this class is as follows:


     


     


     




    .C1GridView_Item



     



    {padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px;}


    The problem is that the padding is NOT applied when the page is run. All the rows / items in the gridview have 0 (zero) padding. Any help would be much appreciated.


    Regards, M.



  • Replied 10 September 2017, 11:34 am EST

    Hi,


    Your css is overridden by VisualStyle applied to the grid:


    I can suggest the following solutions


    1) instead of using .C1GridView_Item try to override padding in the following css classes


    .C1GridView_< name of VisualStyle > .C1Row .C1Gtd


     and


    .C1GridView_< name of VisualStyle > .C1AlternatingItems .C1Gtd


    For example:


       <style type="text/css">


          .C1GridView_ArcticFox .C1Row .C1Gtd,


          .C1GridView_ArcticFox .C1AlternatingItems .C1Gtd


          {


            padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px;            


          }


       </style>


    2) Or (if it is acceptable in your case) you can completely turn off VisualStyle (UseEmbeddedVisualStyles="false", VisualStyle=''),  then .C1GridView_Item will work.


    Regards,


    Sergey

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels