Click here to Skip to main content
15,867,765 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

1 solution

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.NET
<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.
CSS
.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
 
Share this answer
 
v2
Comments
shivani 2013 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900