Click here to Skip to main content
12,697,076 members (29,622 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET .NET C#4.0 .NET4
i have first top most cell with back color red and its adjacent one more cell with black what i want is that i should have some space between both cells i applied cell padding and cell spacing but no change

tell me in this regard

Posted 9-Jan-13 2:08am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Have you specified the gridview's width?
If Yes, then make sure that the width accommodates the padding/cell spacing as well.

Apply CSS styling to the Gridview like this
modify the below to fit your gridview
<asp:GridView ID="GridView1" runat="server" CssClass="mGrid1">

then add the below into your CSS sheet

modify the below to the setting that would suite you visual need.
    width: 100%;
    font-family: tahoma;

.mGrid1 td   /* this applies to the Gridviews Data fileds */
    padding: 1px;
    width: 3%;
    border: solid 1px black;
    border-collapse: collapse;
.mGrid1 th   /* this applies to the Gridviews Headers */
     padding: 0px 0px;
     border-width: 1px;

Hope this helps
Member 7882565 9-Jan-13 7:28am
i am getting all changes at design time but not on run time
joe_j 9-Jan-13 7:30am
I have updated the solution above. Try if that works.
There would be a difference when you view it in IE and CHROME etc.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100