DataGrid Border around earch row

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'd like there to be a border around each row of my data-grid but NOT between
the columns. I've tried setting

BorderColor="Black"
BorderStyle="Solid"
BorderWidth="1px"
ItemStyle-BorderColor="Black"
ItemStyle-BorderStyle="Solid"
ItemStyle-BorderWidth="1px"

at the top of the DataGrid element but, for some reason, these have no
effect. Ideas?

Alex
 
Thanks for Winista's good suggestion.

Hi Alex,

You can use the "GridLines" property Winista has mentioned to set the
DataGrid(or GridView)'s gridline style, it support none, both, horizental,
vertical ... And actually this property is implemented through the html
<table> element's "rules" attribute (you can also utilize it when you use
pure html <table>):

#11.3.1 Borders and rules
http://www.w3.org/TR/html4/struct/tables.html#h-11.3.1

BTW, if you also want to apply some style onto the gridview/datagrid's
gridline, you'll need to use css style class and gridline's style is not
controlled by the gridview/datagrid(html table)'s border setting. Here is
a simple DataGrid which display only horizental gridlines and set its
gridlines and border color to "red":

========datagrid =========
</div>
<asp:DataGrid ID="DataGrid1" runat="server"
DataSourceID="SqlDataSource1"
GridLines="Horizontal" CssClass="Grid">
</asp:DataGrid>
</form>

======css style==========
.Grid
{
border-style:solid;
border-width: 2px;
border-bottom-color:Red;
border-top-color: Red;
border-left-color:red;
border-right-color:red;


}


.Grid th
{

border-width: 2px;
border-bottom-color:Red;
border-top-color: Red;
border-left-color:red;
border-right-color:red

}

.Grid td
{
border-width: 2px;
border-bottom-color:Red;
border-top-color: Red;
border-left-color:red;
border-right-color:red

}
=========================

Hope this also helps.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Hey Alex,

Does the info in my last reply also help some? If there is still anything
we can help, please don't hesitate to post here.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top