469,913 Members | 2,003 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,913 developers. It's quick & easy.

Change DetailsView BorderColor

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!

Apr 14 '07 #1
3 4977
I would suggest resorting to the CssClass property. Associate a style class
to it where you define your background-color.

'Hans Olav.

<rn**@rediffmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
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!

Apr 14 '07 #2
On Apr 15, 2:01 am, "Hans Olav Stjernholm" <n...@email.herewrote:
I would suggest resorting to the CssClass property. Associate a style class
to it where you define your background-color.

'Hans Olav.

<r...@rediffmail.comwrote in message

news:11**********************@w1g2000hsg.googlegro ups.com...
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!- Hide quoted text -

- 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></styletag 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??

Apr 16 '07 #3
On Apr 16, 12:30 pm, r...@rediffmail.com wrote:
On Apr 15, 2:01 am, "Hans Olav Stjernholm" <n...@email.herewrote:


I would suggest resorting to the CssClass property. Associate a style class
to it where you define your background-color.
'Hans Olav.
<r...@rediffmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
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!- Hide quoted text -
- 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></styletag 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>

Apr 16 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by P. Yanzick | last post: by
3 posts views Thread by Jason | last post: by
reply views Thread by esi | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.