Click here to Skip to main content
Rate this: bad
good
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 color........now 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
 

regards
Posted 9-Jan-13 1:08am

1 solution

Rate this: bad
good
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.
.mGrid1
{
    width: 100%;
    font-family: tahoma;
}
 
.mGrid1 td   /* this applies to the Gridviews Data fileds */
{
    padding: 1px;
    text-align:center;
    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
  Permalink  
v2
Comments
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 Gihan Liyanage 332
1 Sergey Alexandrovich Kryukov 330
2 ClimerChinna 222
3 OriginalGriff 206
4 Richard MacCutchan 170
0 Sergey Alexandrovich Kryukov 8,363
1 OriginalGriff 7,112
2 CPallini 2,598
3 Richard MacCutchan 2,025
4 Abhinav S 1,788


Advertise | Privacy | Mobile
Web02 | 2.8.140827.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