How to provide border for gridview each cell

Posted by Bravi under Regular Expressions on 7/5/2011 | Points: 10 | Views : 44533 | Status : [Member] | Replies : 4
How to provide border for gridview each cell




Responses

Posted by: SheoNarayan on: 7/5/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Keep following CSS style in your page

  <style type="text/css">

table, tr, td
{
border:1px solid #c0c0c0;
}
</style>


That should create a border around your cell. Change the color name accordingly.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Bravi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Susanthampy on: 7/5/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,

Refer this,

http://forums.asp.net/t/1199681.aspx

Regards,
Susan

Bravi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 7/5/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi, try this...

<asp:GridView ID="dgviewTeeMen" runat="server" AllowPaging="false" AllowSorting="false"

AutoGenerateColumns="False" Width="500px" height="300px"
HorizontalAlign="Center">
<Columns>
<asp:BoundField DataField="Color" HeaderText="Color" />
<asp:BoundField DataField="ParTotal" HeaderText="Par" />
</Columns>
<HeaderStyle BackColor="#b6b7bc" ForeColor="Red" Font-Names="Arial" Font-Size="14px"
Font-Bold="true" HorizontalAlign="Center" />
<AlternatingRowStyle BackColor="#D5E6F9" ForeColor="#284775" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" Font-Names="Arial" Font-Size="12px"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<FooterStyle HorizontalAlign="Center" BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"
Font-Names="Arial" Font-Size="9px" />
</asp:GridView>


Thanks and Regards
Akiii

Bravi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 7/5/2011 [Member] Starter | Points: 25

Up
0
Down
@Sheo Narayan This is the best solution, but only problem is that it will apply to all table in that page.
can we use
.myGrid td

{
border: 1px solid #ff0000;
}

Then assign this myGrid to CssClass of Gridview.

Thanks,
Debata

Bravi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response