473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Datagrid and formatting problems

I have been trying to figure out what the Datagrid is doing to create its
formatting.

I found that some of my Datagrids have a 3D type of border and sometime it
has a straight line. I finally found that it comes down to whether there is
a "rules=all" attribute (which gives me just a thin black line). If that
attribute is not there, you get a 3D effect.

I haven't yet been able to figure out what causes it. Here is the table def
that has the rules in it:

<table cellspacing="0" cellpadding="3" rules="all" border="1" id="DataGrid1"
style="margin: 5px 5px 5px 5px; padding: 5px;">

The DataGrid is defined as:

<asp:DataGrid AllowPaging="false"
AllowSorting="True"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
ID="DataGrid1"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="SortDataGrid"
borderstyle="none"
style="margin: 5px 5px 5px 5px; padding: 5px;"


I have borderStyle as "none" here and I still have a border - why is that?
And what causes the "rules" attribute?

Thanks,

Tom
Nov 19 '05 #1
5 2727
"tshad" <ts**********@ftsolutions.com> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
I have been trying to figure out what the Datagrid is doing to create its
formatting.

I found that some of my Datagrids have a 3D type of border and sometime it
has a straight line. I finally found that it comes down to whether there
is a "rules=all" attribute (which gives me just a thin black line). If
that attribute is not there, you get a 3D effect.

I haven't yet been able to figure out what causes it. Here is the table
def that has the rules in it:

<table cellspacing="0" cellpadding="3" rules="all" border="1"
id="DataGrid1" style="margin: 5px 5px 5px 5px; padding: 5px;">

The DataGrid is defined as:

<asp:DataGrid AllowPaging="false"
AllowSorting="True"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
ID="DataGrid1"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="SortDataGrid"
borderstyle="none"
style="margin: 5px 5px 5px 5px; padding: 5px;"
>
I have borderStyle as "none" here and I still have a border - why is that?
And what causes the "rules" attribute?


I stripped down my code and have - no styles - no css and just the DataGrid
with the code to fill it.

Here is the Datagrid:

<asp:DataGrid
ID="DataGrid1"
runat="server"
ShowFooter="false"
BorderStyle="none" <Columns>
<asp:BoundColumn DataField="Applied"
ReadOnly="true"
Visible="True">
<itemstyle ForeColor="red" />
</asp:BoundColumn>
<asp:HyperLinkColumn DataTextField="JobTitle"
DataTextFormatString="{0}" DataNavigateUrlField="PositionID"
DataNavigateUrlFormatString="displayPosition.aspx? PositionID={0}"
HeaderText="Job Title"
SortExpression="JobTitle"/>
<asp:BoundColumn DataField="Client"
HeaderText="Company"
ReadOnly="true"
Visible="True"
SortExpression="Client"/>
<asp:BoundColumn DataField="Location"
HeaderText="Location"
ReadOnly="true"
Visible="True"
SortExpression="Location"/>
<asp:BoundColumn DataField="Posted"
HeaderText="Date Posted"
ReadOnly="true"
Visible="True"
SortExpression="DatePosted">
<Itemstyle CssClass="datedisplay" />
</asp:Boundcolumn>
<asp:BoundColumn DataField="lastUpdated"
HeaderText="Last Updated"
ReadOnly="true"
Visible="True"
SortExpression="DateUpdated">
<Itemstyle CssClass="datedisplay" />
</asp:Boundcolumn>
</Columns>
</asp:DataGrid>

Here is the Table tag:

<table cellspacing="0" rules="all" border="1" id="DataGrid1">

The BorderStyle doesn't have any effect at all. Why is there a border?
Where is this rules coming from?

If I add border=0,

I get the tag:

<table cellspacing="0" rules="all" border="0" border="1"
id="DataGrid1">

What gives?

This is driving me crazy. I am getting all kinds of inconsistent results on
my pages. Some DataGrids have the rules=all and some don't. The
BorderStyle, doesn't seem to work anywhere. None or Solid, doesn't seem to
do anything, but border=0 or border=1 seem to work (if rules=all is not
there).

Thanks,

Tom
Thanks,

Tom

Nov 19 '05 #2
Hi,

If you want 3D type of border, set borderStyle to Outset
or Ridge. If you don't want border line, set BorderWidth
as 0px.

Hope it helps,

Elton Wang
el********@hotmail.com
-----Original Message-----
I have been trying to figure out what the Datagrid is doing to create itsformatting.

I found that some of my Datagrids have a 3D type of border and sometime ithas a straight line. I finally found that it comes down to whether there isa "rules=all" attribute (which gives me just a thin black line). If thatattribute is not there, you get a 3D effect.

I haven't yet been able to figure out what causes it. Here is the table defthat has the rules in it:

<table cellspacing="0" cellpadding="3" rules="all" border="1" id="DataGrid1"style="margin: 5px 5px 5px 5px; padding: 5px;">

The DataGrid is defined as:

<asp:DataGrid AllowPaging="false"
AllowSorting="True"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
ID="DataGrid1"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="SortDataGrid"
borderstyle="none"
style="margin: 5px 5px 5px 5px; padding: 5px;"
>
I have borderStyle as "none" here and I still have a

border - why is that?And what causes the "rules" attribute?

Thanks,

Tom
.

Nov 19 '05 #3
"Elton Wang" <an*******@discussions.microsoft.com> wrote in message
news:20****************************@phx.gbl...
Hi,

If you want 3D type of border, set borderStyle to Outset
or Ridge. If you don't want border line, set BorderWidth
as 0px.
I would have thought so also. The problem is that borderStyle doesn't seem
to be working. And the rules="all" is what is making the line solid (not
3D).

Tom
Hope it helps,

Elton Wang
el********@hotmail.com
-----Original Message-----
I have been trying to figure out what the Datagrid is

doing to create its
formatting.

I found that some of my Datagrids have a 3D type of

border and sometime it
has a straight line. I finally found that it comes down

to whether there is
a "rules=all" attribute (which gives me just a thin black

line). If that
attribute is not there, you get a 3D effect.

I haven't yet been able to figure out what causes it.

Here is the table def
that has the rules in it:

<table cellspacing="0" cellpadding="3" rules="all"

border="1" id="DataGrid1"
style="margin: 5px 5px 5px 5px; padding: 5px;">

The DataGrid is defined as:

<asp:DataGrid AllowPaging="false"
AllowSorting="True"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
ID="DataGrid1"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="SortDataGrid"
borderstyle="none"
style="margin: 5px 5px 5px 5px; padding: 5px;"
>


I have borderStyle as "none" here and I still have a

border - why is that?
And what causes the "rules" attribute?

Thanks,

Tom
.

Nov 19 '05 #4
Here is apparently what is happening and is what just drives me crazy about
these objects.

If you have:
<asp:DataGrid
border=3
id="DataGrid1"
runat="server"
Gridlines="None">

Gridlines = "none" - gives you no "rules" attribute and border=x - gives you
an x-size borders and gridlines.. This will give you a 3D effect. If you
have no border attribute or border=0 - you will get no borders and no
gridlines. The above tag will give you the following:

<table cellspacing="0" border="3" border="0" id="DataGrid1">

You will notice the 2 border attributes. If you have border=0 or no border
attribute, you will get border=0 in the table tag. Not sure why I get 2
border attributes if I put in a border tag with a value > 0.

If you have the following tag:

<asp:DataGrid
border=0
id="DataGrid1"
runat="server"

With the Gridlines attribute taken out, you will get the rules="all"
attribute.

<table cellspacing="0" rules="all" border="0" border="1"
id="DataGrid1">

You will also note that there is 2 borders here, one with 0 and one with 1.
This will give you thin gridlines with no border around the table. If you
change the border to something line 2, you will get:

<table cellspacing="0" rules="all" border="2" border="1" id="DataGrid1">

This will give you the same thin gridlines, but the outside border will be a
thick line based on the border attribute (the larger the number the thicker
the line, but the gridlines will still be thin.

So if you want to have thin gridlines, whether you have a border or not,
leave out the gridlines tag (this is probably some default). If you want 3D
lines or no Gridlines, put the gridlines="none" in.

If you have:
<asp:DataGrid
border=2
id="DataGrid1"
runat="server"
BorderStyle="Dotted"
BorderWidth="2"
gridlines="None"


This doesn't seem to effect the DataGrid whether you have the gridlines tag
or not (the BorderStyle and BorderWidth tags - which are supposed to be
available).

Very frustrating.

Tom

snip
Nov 19 '05 #5
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eT*************@TK2MSFTNGP10.phx.gbl...
Here is apparently what is happening and is what just drives me crazy
about these objects.

If you have:
<asp:DataGrid
border=3
id="DataGrid1"
runat="server"
Gridlines="None">

Gridlines = "none" - gives you no "rules" attribute and border=x - gives
you an x-size borders and gridlines.. This will give you a 3D effect. If
you have no border attribute or border=0 - you will get no borders and no
gridlines. The above tag will give you the following:

<table cellspacing="0" border="3" border="0" id="DataGrid1">

You will notice the 2 border attributes. If you have border=0 or no
border attribute, you will get border=0 in the table tag. Not sure why I
get 2 border attributes if I put in a border tag with a value > 0.

If you have the following tag:

<asp:DataGrid
border=0
id="DataGrid1"
runat="server"
>
With the Gridlines attribute taken out, you will get the rules="all"
attribute.

<table cellspacing="0" rules="all" border="0" border="1"
id="DataGrid1">

You will also note that there is 2 borders here, one with 0 and one with
1. This will give you thin gridlines with no border around the table. If
you change the border to something line 2, you will get:

<table cellspacing="0" rules="all" border="2" border="1" id="DataGrid1">

This will give you the same thin gridlines, but the outside border will be
a thick line based on the border attribute (the larger the number the
thicker the line, but the gridlines will still be thin.

So if you want to have thin gridlines, whether you have a border or not,
leave out the gridlines tag (this is probably some default). If you want
3D lines or no Gridlines, put the gridlines="none" in.

If you have:
<asp:DataGrid
border=2
id="DataGrid1"
runat="server"
BorderStyle="Dotted"
BorderWidth="2"
gridlines="None"
>


This doesn't seem to effect the DataGrid whether you have the gridlines
tag or not (the BorderStyle and BorderWidth tags - which are supposed to
be available).


An addendum:

If you have gridlines="none" and border=1 or higher, you get a 3D grid which
is the same size no matter what. You can't seem to affect the color using
either BorderColor="#990033" or style="border-color=#990033;". The grid
looks good in Mozilla, but you can hardly see it in IE. If you want to set
the color in IE, you can set gridlines="both" and then
BorderColor="#990033" works in IE, but not in Mozilla. In Mozilla, you will
get the same 3D grid, regardless of the border value (as long as it is > 0).

I am having a hard time getting any consistancy here.

Tom
Very frustrating.

Tom

snip

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Billy Jacobs | last post by:
I have a bound datagrid and I want to set the cells of any item of a certain column whose value is greater than 100 to a different color. How do I accomplish this?
2
by: Dave | last post by:
Is it possible to change the backcolor of all rows in a Windows VB.Net DataGrid that have a common characteristic. For example, all rows with a balance < $0?
0
by: Frnak McKenney | last post by:
One of the reasons given for the Allied victory in WWI is that the Nazi armament industry invested so much effort in creating new weapons (e.g. the jet plane) it wasn't able to develop any of them...
7
by: Matthew Wieder | last post by:
Hi - I have a datagrid that has a black header and the rows alternate white and gray. The problem is that until items are added to the grid, the grid appears as a large black rectangle, which is...
2
by: Sebi | last post by:
Hello all is it possible to add a checkbox in a DataGrid for Boolean Data? Thanks in advance
3
by: McNutt Consulting | last post by:
I'm trying to implement a datagrid with dynamically created columns. The data is coming out of a very simple XML file, and it's bound through a dataview. The datagrid is just a shell definition...
4
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
4
by: Pat | last post by:
I'm trying to do a sorting in a Datagrid below but i'm getting ERRROR:- "Line 1: Incorrect syntax near 'CompanyID'." strQuery = "Select InvoiceDate,OrderDate From CMRC_Orders ORDER BY " & _...
7
by: Dave | last post by:
Are there any add-on products or samples available that can do the following in an vb.net datagrid I want to compare 2 rows in a datagrid - one row from one database and another row for another...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.