Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.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 1: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 at 9-Jan-13 7:28am
i am getting all changes at design time but not on run time
joe_j at 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
0 OriginalGriff 553
1 CPallini 470
2 Sergey Alexandrovich Kryukov 418
3 George Jonsson 231
4 Afzaal Ahmad Zeeshan 194
0 OriginalGriff 5,370
1 CPallini 4,360
2 Sergey Alexandrovich Kryukov 3,822
3 George Jonsson 3,037
4 Gihan Liyanage 2,435

Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2014
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