DataGrid Border around earch row

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
 
S

Steven Cheng[MSFT]

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.)
 
S

Steven Cheng[MSFT]

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.)
 
Joined
Jun 1, 2007
Messages
2
Reaction score
0
Hello Steven,
Thank you very much. Your suggestion worked for me :) Thanks a bunch!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top