473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 5166
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
2
by: sck10 | last post by:
Hello, I am trying to programically make the following TemplateField ("MyTemplate") visible when the user clicks on the "Edit" Button using the PreRender handle event. My question is, how do...
4
by: P. Yanzick | last post by:
Hello, I've been playing with master/detail views as well as editing in the gridview, and I ran across a strange problem that I am not exactly sure where to go to try to solve. I have 2...
3
by: Jason | last post by:
Anyone know how to make the text wrap in a text box of a DetailsView?
0
by: ButlerDJIAM | last post by:
I have pasted code I have in an ASPx page and I want to know how to make it not display a field that is empty. There does not seem to be anything online (MSDN) that explains it. Usually the alt...
1
by: dhaneshrs | last post by:
I have a small code that shows inactive and active users from the ms access DB. <%@ Page Language="VB" MasterPageFile="~/MasterPageAdmin.master" Title="Welcome" %> <%@ Import...
2
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created...
0
by: esi | last post by:
New to ASP.NET so any help you can offer would be great! I have been searching the web all day to try and figure out how I can add a default value to a field on a DetailsView control. I did...
0
by: | last post by:
I'm using a detailsview to insert a record, should be simple enough? What am I doing wrong? Thank you for your help. The user fills in all the textboxes and hits insert. I've tried every event...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.