Change DetailsView BorderColor

R

rn5a

How do I change the BorderColor of the rows under the 2nd column in a
DetailsView?

I could change the BorderColor of the 1st column using the
FieldHeaderStyle-BorderColor property but using RowStyle-BorderColor,
the BorderColor of the 2nd column just refuses to change.

I even tried using AlternatingRowStyle-BorderColor but that doesn't
make any difference. What is surprising is the other properties of
RowStyle & AlternatingRowStyle like BackColor, Font-Italic, Font-
Strikeout, Font-Underline etc. work as expected; only the BorderColor
refuses to budge!
 
H

Hans Olav Stjernholm

I would suggest resorting to the CssClass property. Associate a style class
to it where you define your background-color.

'Hans Olav.
 
R

rn5a

I would suggest resorting to the CssClass property. Associate a style class
to it where you define your background-color.

'Hans Olav.








- Show quoted text -

No Hans your suggestion doesn't work out as well. This is what I
tried:

<style>
..formatrow{
border-color:"black";
border-width:10;
background-color:"ghostwhite";
font-family:'Courier New';
font-size:12;
}
</style>

<asp:DetailsView ID="MyDV" BorderColor="black" BorderWidth="2"
CssClass="formatrow" FieldHeaderStyle-BackColor="black"
FieldHeaderStyle-BorderColor="black" FieldHeaderStyle-BorderWidth="2"
FieldHeaderStyle-ForeColor="ghostwhite" runat="server">
<RowStyle CssClass="formatrow"/>
<AlternatingRowStyle CssClass="formatrow"/>
<CommandRowStyle CssClass="formatrow"/>
<EditRowStyle CssClass="formatrow"/>
<EmptyDataRowStyle CssClass="formatrow"/>
<FooterStyle CssClass="formatrow"/>
<HeaderStyle CssClass="formatrow"/>
<InsertRowStyle CssClass="formatrow"/>
<PagerStyle CssClass="formatrow"/>
</asp:DetailsView>

Each & every property changes when the corresponding property within
the <style></style> tag is changed except for the border-color &
border-width!

I even tried this:

Sub Page_Load(.....)
MyDV.AlternatingRowStyle.BorderColor = Drawing.Color.Black
MyDV.AlternatingRowStyle.BorderWidth = 10
MyDV.RowStyle.BorderColor = Drawing.Color.Black
MyDV.RowStyle.BorderWidth = 10
MyDV.CommandRowStyle.BorderColor = Drawing.Color.Black
MyDV.CommandRowStyle.BorderWidth = 10
MyDV.EditRowStyle.BorderColor = Drawing.Color.Black
MyDV.EditRowStyle.BorderWidth = 10
MyDV.FooterStyle.BorderColor = Drawing.Color.Black
MyDV.FooterStyle.BorderWidth = 10
MyDV.HeaderStyle.BorderColor = Drawing.Color.Black
MyDV.HeaderStyle.BorderWidth = 10
MyDV.InsertRowStyle.BorderColor = Drawing.Color.Black
MyDV.InsertRowStyle.BorderWidth = 10
MyDV.PagerStyle.BorderColor = Drawing.Color.Black
MyDV.PagerStyle.BorderWidth = 10
End Sub

But this doesn't work out as well! In fact, I put the above lines in
all the different sub-routines that are present in this ASPX page but
all my efforts went in vain & have gone down the drain.

Any other suggestions??
 
R

rn5a

No Hans your suggestion doesn't work out as well. This is what I
tried:

<style>
.formatrow{
border-color:"black";
border-width:10;
background-color:"ghostwhite";
font-family:'Courier New';
font-size:12;}

</style>

<asp:DetailsView ID="MyDV" BorderColor="black" BorderWidth="2"
CssClass="formatrow" FieldHeaderStyle-BackColor="black"
FieldHeaderStyle-BorderColor="black" FieldHeaderStyle-BorderWidth="2"
FieldHeaderStyle-ForeColor="ghostwhite" runat="server">
<RowStyle CssClass="formatrow"/>
<AlternatingRowStyle CssClass="formatrow"/>
<CommandRowStyle CssClass="formatrow"/>
<EditRowStyle CssClass="formatrow"/>
<EmptyDataRowStyle CssClass="formatrow"/>
<FooterStyle CssClass="formatrow"/>
<HeaderStyle CssClass="formatrow"/>
<InsertRowStyle CssClass="formatrow"/>
<PagerStyle CssClass="formatrow"/>
</asp:DetailsView>

Each & every property changes when the corresponding property within
the <style></style> tag is changed except for the border-color &
border-width!

I even tried this:

Sub Page_Load(.....)
MyDV.AlternatingRowStyle.BorderColor = Drawing.Color.Black
MyDV.AlternatingRowStyle.BorderWidth = 10
MyDV.RowStyle.BorderColor = Drawing.Color.Black
MyDV.RowStyle.BorderWidth = 10
MyDV.CommandRowStyle.BorderColor = Drawing.Color.Black
MyDV.CommandRowStyle.BorderWidth = 10
MyDV.EditRowStyle.BorderColor = Drawing.Color.Black
MyDV.EditRowStyle.BorderWidth = 10
MyDV.FooterStyle.BorderColor = Drawing.Color.Black
MyDV.FooterStyle.BorderWidth = 10
MyDV.HeaderStyle.BorderColor = Drawing.Color.Black
MyDV.HeaderStyle.BorderWidth = 10
MyDV.InsertRowStyle.BorderColor = Drawing.Color.Black
MyDV.InsertRowStyle.BorderWidth = 10
MyDV.PagerStyle.BorderColor = Drawing.Color.Black
MyDV.PagerStyle.BorderWidth = 10
End Sub

But this doesn't work out as well! In fact, I put the above lines in
all the different sub-routines that are present in this ASPX page but
all my efforts went in vain & have gone down the drain.

Any other suggestions??- Hide quoted text -

- Show quoted text -

OK....mate....I got it. This is what I had to do:

<asp:DetailsView ID="Mydv" AutoGenerateRows="false"
BorderColor="black" BorderWidth="2" CellSpacing="1" FieldHeaderStyle-
BackColor="black" FieldHeaderStyle-BorderColor="ghostwhite"
FieldHeaderStyle-BorderWidth="1" FieldHeaderStyle-
ForeColor="ghostwhite" Width="90%" runat="server">
<RowStyle CssClass="formatrow"/>
<Fields>
<asp:TemplateField HeaderText="NAME" ItemStyle-BackColor="ghostwhite"
ItemStyle-BorderColor="black" ItemStyle-BorderWidth="1">
<ItemTemplate>
<asp:Label ID="lblName" Text='<%# Container.DataItem("CustomerName")
%>' runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="E-MAIL" ItemStyle-
BackColor="ghostwhite" ItemStyle-BorderColor="black" ItemStyle-
BorderWidth="1">
<ItemTemplate>
<asp:Label ID="lblEMail" Text='<%# Container.DataItem("EMail") %>'
runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="TELEPHONE NO." ItemStyle-
BackColor="ghostwhite" ItemStyle-BorderColor="black" ItemStyle-
BorderWidth="1">
<ItemTemplate>
<asp:Label ID="lblPhone" Text='<%# Container.DataItem("Phone") %>'
runat="server"/>
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top