ItemStyle.Width doens't adjust the size of a column?

G

Greg P.

I've been looking at this for a while trying to figure out how to change the
column size of a GridView. From my understanding I should be able to set
this property in design time by editing the columns and setting the
itemStyle.width property. When I do this I do not see any changes? The only
way I've been able to work around this is to covert the column into a
templateColumn and edit the width of the label that is generated, which seems
like a hack.

Any ideas why the itemStyle property deosn't seem to be asserting itself?
(look at the "notes" column in the code below)

<asp:panel ID="Panel1" runat="server" Height="159px" ScrollBars="Auto"
Width="642px">
<asp:GridView ID="vwEmployee" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="EmployeeID"
DataSourceID="dsEmployee" OnRowCreated="vwEmployee_RowCreated">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="Button4" runat="server"
CommandName="Select" Text="Select" Width="61px" /><br />
<asp:Button ID="Button2" runat="server"
CommandName="Update" Text="Update" /><br />
<asp:Button ID="Button3" runat="server"
CommandName="Delete" Text="Delete" Width="60px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EmployeeID"
SortExpression="EmployeeID" Visible="False">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Eval("EmployeeID") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label14" runat="server" Text='<%#
Bind("EmployeeID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="LastName"
SortExpression="Last Name">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%#
Bind("LastName") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%#
Bind("LastName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FirstName"
SortExpression="First Name">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%#
Bind("FirstName") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%#
Bind("FirstName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Position"
SortExpression="Title">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%#
Bind("Title") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%#
Bind("Title") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%#
Bind("TitleOfCourtesy") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%#
Bind("TitleOfCourtesy") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address"
SortExpression="Address">
<EditItemTemplate>
<asp:TextBox ID="TextBox6" runat="server" Text='<%#
Bind("Address") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%#
Bind("Address") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="City" SortExpression="City">
<EditItemTemplate>
<asp:TextBox ID="TextBox7" runat="server" Text='<%#
Bind("City") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%#
Bind("City") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Region"
SortExpression="Region">
<EditItemTemplate>
<asp:TextBox ID="TextBox8" runat="server" Text='<%#
Bind("Region") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%#
Bind("Region") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Zip"
SortExpression="PostalCode">
<EditItemTemplate>
<asp:TextBox ID="TextBox9" runat="server" Text='<%#
Bind("PostalCode") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%#
Bind("PostalCode") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Country"
SortExpression="Country">
<EditItemTemplate>
<asp:TextBox ID="TextBox10" runat="server" Text='<%#
Bind("Country") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label10" runat="server" Text='<%#
Bind("Country") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Phone"
SortExpression="HomePhone">
<EditItemTemplate>
<asp:TextBox ID="TextBox11" runat="server" Text='<%#
Bind("HomePhone") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label11" runat="server" Text='<%#
Bind("HomePhone") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Extension"
SortExpression="Extension">
<EditItemTemplate>
<asp:TextBox ID="TextBox12" runat="server" Text='<%#
Bind("Extension") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label12" runat="server" Text='<%#
Bind("Extension") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Notes" ItemStyle-Width="200px">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("Notes") %>'></asp:TextBox>
</EditItemTemplate>

<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("Notes") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Width="300px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="ReportsTo"
SortExpression="ReportsTo">
<EditItemTemplate>
<asp:TextBox ID="TextBox13" runat="server" Text='<%#
Bind("ReportsTo") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label13" runat="server" Text='<%#
Bind("ReportsTo") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:panel>

Thanks,
Greg
 
G

Greg P.

Here is another simple attempt to no avail.

<asp:BoundField DataField="CompanyName" HeaderText="CompanyName"
SortExpression="CompanyName">
<ItemStyle Width="250px" />

</asp:BoundField>

Thanks again
 
J

John Cantley

I am getting the same crap. I set every width I can find.
<asp:BoundField DataField="Score" HeaderText="Score" ReadOnly="True" >
<ItemStyle Width="300px" />
<ControlStyle Width="300px" />
<HeaderStyle Width="300px" />
</asp:BoundField>

It never changes anything.

Thanks,
John Cantley
 
G

Greg P.

Yeah i hear ya John, I'm hoping to hear something back from MS on this. This
is a managed news group and I still haven't heard anything. I think it is a
bug but I'll wait to hear from MS before assuming that.
 
K

Kevin Fernandes

Hi,
I'll take a stab at this (so I apologize in advance if this isn't right :)

I would take a look at the asp:panel that the grid view is in. It has a
width set at 642px and, in my testing, it seems that with the width set
on a panel control, anything within the panel will try to fit that
width. Given that one of your columns is 300px (half the width of the
panel almost) and the number of other columns listed (sizes of which are
variable) I would guess that the grid view is squeezing itself to fit
the panel width.

Try, removing the width setting on the panel control, this will allow it
to size dynamically, and see if your column widths work then.

Good luck
Kevin F.
 
G

Greg P.

Kevin,

Thanks for the response, unfortunatly this happens when the gridView is not
in a panel also. If I can figure out how I eill attach a copy of my website
with the northwind database included. I was attempting to change the width
of the notes field from the employee table. Let me know what you think.

FYI - ignore the ajax stuff. This was a site I put together to run ajax
with out installing it.

Thanks,
Greg
 
K

Kevin Fernandes

Hi Greg,
The attachment didn't get through (that I can tell), not sure if its my
end or the news group not supporting it.

Sorry my previous suggestion didn't work.

I use a lot of GridViews in my work and I even tried a couple of new
examples when I saw your message but everything seems to work fine for
me. I was only able to repeat the problem you described when I included
the GridView in a panel and the panel had its width set.

There must be something different, possibly our environments that may be
causing this. Here are a couple of more things to look into, just in
case: Is the GridView in some other container object, like a div or
form that has a width set? How about a master page, I have noticed
problems with certain formatting when an item is in a master page. Have
you looked at the generated HTML source to see if the formatting is what
you expect to be generated? Could it be a browser issue? (I am still
using IE 6 and it works fine there). Are you using Skins or other CSS
styles that maybe overriding the width?

I can post a simple example, if you like, that I just tested and know it
works to see if you can get it to work as well. Let me know.

I do agree, that it wold be nice to hear from a Microsoft (or moderator)
person this as well.

Good luck,
Kevin F.
:)
 
G

Greg P.

Kevin,

no luck so far. I created a new website, added the northwind database and a
gridview. I configured the source to show the employee table and still see
the same problem. Here is the HTML; you can see that the td for the "notes"
column (search the text for width) is set to 150. This doesn't change any
thing? I'm curious if you run this page if you see the same thing? I am
using IE7 so that is a possibility, but I've even run it on another co
workers box and saw the same thing in IE6... I have no idea at this point.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="HBTi/d6L5w/3qKx4P3UawuMULcg9YP4FUh0uwE66DpsIBwCmeuVFu+Hbdo90bbscUxPYh/iEVbUbJaOeQ6Fv54dbZoOKiBfZKzdrJ1BaHMgFTS5oND7/RjbQd8BKaNzQd9bTRlgpf/15kbZLqzvG8RXB0SKdolmYlqoHzo9oh7i/wQzZW4Jx4sYFjvfKQLZGk3a1e6NTzSdW0NUP/ogH+CqAhy79up4puhfGLhw34XylicFo1ONwXU0papdNj+NkgWI/gRyBb4oF3fiZFXc28y1d4FAAbz/eg7bS754kAngfZbyWXUL5KxIU6iWJ7Eag6ZC38ohM7zLGjV7D5kbJoWvw4EdaWs+WTNJisWgFQol2+yClSg2VZHUxMPFFJNzWBoAPypI7DXUYhNmPCQyVL2cI/rFxyIElk8juxkF5wtJQSXrEOqFptpgp8922WqmuqlQv/5F/UJkUls6AOUawetiawPwzC6+lLZ89qxymIsCLIbkeVckz8+KZ21etZIbWkYiXnDzbah8ndBdg1SsbZO0QaZJmWfrB5ci9Cx/SmryJzUbMKGmG9DX/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jPx0CgHOvoJTD52oEGLHRrgS3AAdMVkwggZfPxmZmNTOTwvaGd0sQ2FaW8V32sjnJ6Lpw==" />
</div> <div> <div> <table cellspacing="0" rules="all" border="1"
id="GridView1"
style="border-collapse:collapse;"> <tr> <th scope="col">EmployeeID</th><th
scope="col">LastName</th><th
scope="col">FirstName</th><th scope="col">Title</th><th
scope="col">TitleOfCourtesy</th><th scope="col">BirthDate</th><th
scope="col">HireDate</th><th scope="col">Address</th><th
scope="col">City</th><th scope="col">Region</th><th
scope="col">PostalCode</th><th scope="col">Country</th><th
scope="col">HomePhone</th><th scope="col">Extension</th><th
scope="col">Notes</th><th scope="col">ReportsTo</th><th
scope="col">PhotoPath</th>
</tr><tr><td>1</td><td>Davolio</td><td>Nancy</td><td>Sales
Representative</td><td>Ms.</td><td>12/8/1948 12:00:00 AM</td><td>5/1/1992
12:00:00 AM</td><td>507 - 20th Ave. E.
Apt. 2A</td><td>Seattle</td><td>WA</td><td>98122</td><td>USA</td><td>(206)
555-9857</td><td>5467</td><td style="width:150px;">Education includes a BA in
psychology from Colorado State University in 1970. She also completed "The
Art of the Cold Call." Nancy is a member of Toastmasters
International.</td><td>2</td><td>http://accweb/emmployees/davolio.bmp</td>
</tr><tr><td>2</td><td>Fuller</td><td>Andrew</td><td>Vice President,
Sales</td><td>Dr.</td><td>2/19/1952 12:00:00 AM</td><td>8/14/1992 12:00:00
AM</td><td>908 W. Capital
Way</td><td>Tacoma</td><td>WA</td><td>98401</td><td>USA</td><td>(206)
555-9482</td><td>3457</td><td style="width:150px;">Andrew received his BTS
commercial in 1974 and a Ph.D. in international marketing from the University
of Dallas in 1981. He is fluent in French and Italian and reads German. He
joined the company as a sales representative, was promoted to sales manager
in January 1992 and to vice president of sales in March 1993. Andrew is a
member of the Sales Management Roundtable, the Seattle Chamber of Commerce,
and the Pacific Rim Importers
Association.</td><td> </td><td>http://accweb/emmployees/fuller.bmp</td>
</tr><tr><td>3</td><td>Leverling</td><td>Janet</td><td>Sales
Representative</td><td>Ms.</td><td>8/30/1963 12:00:00 AM</td><td>4/1/1992
12:00:00 AM</td><td>722 Moss Bay
Blvd.</td><td>Kirkland</td><td>WA</td><td>98033</td><td>USA</td><td>(206)
555-3412</td><td>3355</td><td style="width:150px;">Janet has a BS degree in
chemistry from Boston College (1984). She has also completed a certificate
program in food retailing management. Janet was hired as a sales associate
in 1991 and promoted to sales representative in February
1992.</td><td>2</td><td>http://accweb/emmployees/leverling.bmp</td>
</tr><tr><td>4</td><td>Peacock</td><td>Margaret</td><td>Sales
Representative</td><td>Mrs.</td><td>9/19/1937 12:00:00 AM</td><td>5/3/1993
12:00:00 AM</td><td>4110 Old Redmond
Rd.</td><td>Redmond</td><td>WA</td><td>98052</td><td>USA</td><td>(206)
555-8122</td><td>5176</td><td style="width:150px;">Margaret holds a BA in
English literature from Concordia College (1958) and an MA from the American
Institute of Culinary Arts (1966). She was assigned to the London office
temporarily from July through November
1992.</td><td>2</td><td>http://accweb/emmployees/peacock.bmp</td>
</tr><tr>
<td>5</td><td>Buchanan</td><td>Steven</td><td>Sales
Manager</td><td>Mr.</td><td>3/4/1955 12:00:00 AM</td><td>10/17/1993 12:00:00
AM</td><td>14 Garrett Hill</td><td>London</td><td> </td><td>SW1
8JR</td><td>UK</td><td>(71) 555-4848</td><td>3453</td><td
style="width:150px;">Steven Buchanan graduated from St. Andrews University,
Scotland, with a BSC degree in 1976. Upon joining the company as a sales
representative in 1992, he spent 6 months in an orientation program at the
Seattle office and then returned to his permanent post in London. He was
promoted to sales manager in March 1993. Mr. Buchanan has completed the
courses "Successful Telemarketing" and "International Sales Management." He
is fluent in
French.</td><td>2</td><td>http://accweb/emmployees/buchanan.bmp</td>
</tr><tr>
<td>6</td><td>Suyama</td><td>Michael</td><td>Sales
Representative</td><td>Mr.</td><td>7/2/1963 12:00:00 AM</td><td>10/17/1993
12:00:00 AM</td><td>Coventry House
Miner Rd.</td><td>London</td><td> </td><td>EC2 7JR</td><td>UK</td><td>(71)
555-7773</td><td>428</td><td style="width:150px;">Michael is a graduate of
Sussex University (MA, economics, 1983) and the University of California at
Los Angeles (MBA, marketing, 1986). He has also taken the courses
"Multi-Cultural Selling" and "Time Management for the Sales Professional."
He is fluent in Japanese and can read and write French, Portuguese, and
Spanish.</td><td>5</td><td>http://accweb/emmployees/davolio.bmp</td>
</tr><tr>
<td>7</td><td>King</td><td>Robert</td><td>Sales
Representative</td><td>Mr.</td><td>5/29/1960 12:00:00 AM</td><td>1/2/1994
12:00:00 AM</td><td>Edgeham Hollow
Winchester Way</td><td>London</td><td> </td><td>RG1
9SP</td><td>UK</td><td>(71) 555-5598</td><td>465</td><td
style="width:150px;">Robert King served in the Peace Corps and traveled
extensively before completing his degree in English at the University of
Michigan in 1992, the year he joined the company. After completing a course
entitled "Selling in Europe," he was transferred to the London office in
March 1993.</td><td>5</td><td>http://accweb/emmployees/davolio.bmp</td>
</tr><tr>
<td>8</td><td>Callahan</td><td>Laura</td><td>Inside Sales
Coordinator</td><td>Ms.</td><td>1/9/1958 12:00:00 AM</td><td>3/5/1994
12:00:00 AM</td><td>4726 - 11th Ave.
N.E.</td><td>Seattle</td><td>WA</td><td>98105</td><td>USA</td><td>(206)
555-1189</td><td>2344</td><td style="width:150px;">Laura received a BA in
psychology from the University of Washington. She has also completed a
course in business French. She reads and writes
French.</td><td>2</td><td>http://accweb/emmployees/davolio.bmp</td>
</tr><tr>
<td>9</td><td>Dodsworth</td><td>Anne</td><td>Sales
Representative</td><td>Ms.</td><td>1/27/1966 12:00:00 AM</td><td>11/15/1994
12:00:00 AM</td><td>7 Houndstooth Rd.</td><td>London</td><td> </td><td>WG2
7LT</td><td>UK</td><td>(71) 555-4444</td><td>452</td><td
style="width:150px;">Anne has a BA degree in English from St. Lawrence
College. She is fluent in French and
German.</td><td>5</td><td>http://accweb/emmployees/davolio.bmp</td>
</tr>
</table>
</div>


</div>

<div>

<input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED"
value="" />
</div></form>
</body>
</html>
 
G

Greg P.

Kevin,

Found some interesting behavior, the notes column is not close tot he
beginning of the table so i set the visible property for the preceding
columns to false and saw the correct behavior out of the item style.width
property. If you then make the other columns visible again the table get
scrunched.

This makes me think that the minimumn width for a column would be the header
or the longest single word in a column. This seems to be the case, but then
I thought that if it was put into a panel there should not be a problems if
there werer scroll bar options. This is not true, there seems to be a max
width on a window or? Any ideas?

FYI: I did also see the behavior you were speaking of where if you put the
grid in a panel and the width is set the table will be scrunched into the
panel. When I didn't set the width and had the columns visible the table was
still scrunched.

Thanks,
Greg
 
K

Kevin Fernandes

Hi Greg,
I have not had a chance to delve too deeply into this yet but it looks
like some kind of HTML limitation not an ASP.NET limit.

I created a new page and standard table with all the columns you have in
your listing and can repeat the problem in all browsers and editors so far.

I will try some more tonight and let you know what else I might have found.

Thanks,
Kevin F.
Kevin,

no luck so far. I created a new website, added the northwind database and a
gridview. I configured the source to show the employee table and still see
the same problem. Here is the HTML; you can see that the td for the "notes"
column (search the text for width) is set to 150. This doesn't change any
thing? I'm curious if you run this page if you see the same thing? I am
using IE7 so that is a possibility, but I've even run it on another co
workers box and saw the same thing in IE6... I have no idea at this point.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="HBTi/d6L5w/3qKx4P3UawuMULcg9YP4FUh0uwE66DpsIBwCmeuVFu+Hbdo90bbscUxPYh/iEVbUbJaOeQ6Fv54dbZoOKiBfZKzdrJ1BaHMgFTS5oND7/RjbQd8BKaNzQd9bTRlgpf/15kbZLqzvG8RXB0SKdolmYlqoHzo9oh7i/wQzZW4Jx4sYFjvfKQLZGk3a1e6NTzSdW0NUP/ogH+CqAhy79up4puhfGLhw34XylicFo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0e4tn/CpYR176sUF1bzo3amJwDprBZMznB/Kv+5P2M/1LsK4Q4qWl9QxuoXXcrU9cucn+AWre3gbLqOnyTNcVQb/LFb3jmPAe7fqMRr48H6oZCSFMM0sYFQzBF2p53tJ9sbuefp1IFVVNfm4Kp+5XqpIGI
1+hzN1IROwgf8NJg3Z4nPKTjY5X8kRt93KjhU9esetej7aREnXS9B1Y2Kh9+Ih/1FVA4PDh9HztxLenwOyd3ikRZCrSG4iv9ixgf975WwC4W3PUYbs9H4BfTx8v8MwHKuKwoL+Fpw2o+3FuxhX6vkZNQ+VvmPBHU6oXOIal8DpdjPx0CgHOvoJTD52oEGLHRrgS3AAdMVkwggZfPxmZmNTOTwvaGd0sQ2FaW8V32sjnJ6Lpw==" />
 
K

Kevin Fernandes

Yes I am able to repeat the problem, but I am not sure its the answer
your hoping for.

The problem is with the HTML table itself. I am not sure I can explain
this part properly, maybe someone else with better knowledge can do it,
but I think its something like this.

By not specifying a width for the table its taking an internal (browser)
default value which could be one of two things; fit the columns to the
data (and its specified width if any), column headers dictate minimum
width as long as the width of all columns is < 100% of the container; or
table width is 100%, which ever is smaller. As I said, I probably do
not have the correct explanation for this, so hopefully someone else can
explain it better.

In your case, at least, the case you sent as plain HTML, there are more
columns in the table than can possibly fit the width of the browser
window (or the containing HTML object i.e. DIV) so its defaulting the
table width to 100%, ignoring specified column widths, and sizing the
columns to their smallest possible fit (typically the header size). I
removed most of the columns from your example and was able to get the
column sizing to work correctly. As soon as I added enough columns to
make the table larger than the browser window, the specified column
sizes were ignored.

So you have a few options (there are probably more);
1. Eliminate columns from the GridView that you don't need, to reduce
the overall table width (an identity column for instance or employee ID
if its not needed).
2. Specify a large width for the GridView, I used 300% on your table,
which worked to get your specified column sizes but may not give you the
overall result you want.
3. Re-design this view differently, such as a master-detail type view.
You would specify the minimum number of columns in the GridView then
selecting an item in the GridView would display a DetailsView either on
the same or new page, showing all of the detailed information.

I typically use master-detail view, showing 3 or 4 columns of
information with a select button which brings up a detail view of the
information.

Sorry for the long-winded response but I hope this helps you out,
Kevin F.
 
G

Greg P.

Kevin,

I completely agree and have come to the same sort of conclustion. Your idea
to set the table size to 300% was the eye opener that really helped
illustrate the limitations of an html table. My original assumption was that
if you put the table in a panel and activated the scroll bars that there
should not be a limitation on the width. Thanks for all of your time and
thought into this and I know I learned something, hopefully you did also.

Ciao,
Greg P
 
B

Brett

Hey Folks:

I would like to bump this. Did anyone ever figure the means to get
ControlStyle-Width to work properly. I've tried all sorts of combinations
and my gridview seems to want to do its own thing, regardless.

Thanks
 
P

Paul Shapiro

Here's what I've used in a GridView for other style-related settings. I
don't understand why the setting seems to be repeated in the BoundField
element and again in separate HeaderStyle and ItemStyle elements, but that's
how the code was written when I entered the design-time Property settings.
<asp:BoundField DataField="OrderNum" HeaderText="Order #"
SortExpression="OrderNum"
HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" >
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>

I'm not sure it would work the same in a GridView, but here's what set the
textbox width in a DetailsView control.
<asp:BoundField DataField="attributeName" HeaderText="Attribute Label"
SortExpression="attributeName">
<controlstyle width="250px" /> </asp:BoundField>
 

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,922
Messages
2,570,047
Members
46,475
Latest member
RacheleGri

Latest Threads

Top