473,394 Members | 1,766 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,394 software developers and data experts.

Data Grid Column Widths

Hello,

I am using a datagrid and am trying to control the column widths for each
column. Is this possible? I have tried using the following:
ControlStyle-BorderWidth="1000" with no apparent results.
temStyle-BorderWidth="200" with my column turning black.
ControlStyle-Width="200" with no apparent results.

Any help would be appreciated.

--
Thanks in advance,

sck10

Snippet:
--------
<!-- GridView: Show list of web documents -->
<asp:GridView ID="gvWebDocList" Runat="server" DataSourceID="dsWebDocList"
AutoGenerateColumns="False" AllowPaging="True" PageSize="40"
PagerSettings-Mode="Numeric"
CellPadding="3" HeaderStyle-HorizontalAlign="Center"
CssClass="sckArial_BlkM08"
RowStyle-CssClass="sckArial_BlkM08"
HeaderStyle-CssClass="sckArial_BlueB08"
HorizontalAlign="Left"
BorderWidth="1px"
RowStyle-BorderColor="#000000" RowStyle-BorderStyle="Solid"
GridLines="Both">
<Columns>
<asp:BoundField HeaderText="Doc Group" DataField="strWebDocGroup" />

<asp:BoundField HeaderText="Doc Type" DataField="strWebDocType" />

<asp:HyperLinkField
HeaderText="Title"
DataTextField="strWebAddress"
DataNavigateUrlFields="strWebAddress"
SortExpression="strWebAddress" />

<asp:TemplateField
headertext="Submitter">
<itemtemplate>
<a
href='mailto:<%#Eval("strOwnerEmail")%>'><%#Eval(" strSubmitter")%></a>
</itemtemplate>
</asp:TemplateField>

</Columns>
</asp:GridView>
Nov 18 '05 #1
3 3800
You can try something like this...

<asp:datagrid id="dgTimes" CssClass="DataGrid" runat="server"
AutoGenerateColumns="False" CellPadding="0"
GridLines="None">
<Columns>
<asp:BoundColumn Visible="False" DataField="OpenHouseID"
ReadOnly="True"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Mls Numer">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" Height="25px" Width="70px"
VerticalAlign="Middle"></ItemStyle>
<ItemTemplate>
<asp:Label ID="Label1" Runat="server" CssClass="labelBlue">
<%# DataBinder.Eval(Container.DataItem,"MlsNumber") %>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="Label2" Runat="server" CssClass="labelBlue">
<%# DataBinder.Eval(Container.DataItem,"MlsNumber") %>
</asp:Label>
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

--
Alex Mueller
"sck10" <sc***@online.nospam> wrote in message
news:uO**************@TK2MSFTNGP14.phx.gbl...
Hello,

I am using a datagrid and am trying to control the column widths for each
column. Is this possible? I have tried using the following:
ControlStyle-BorderWidth="1000" with no apparent results.
temStyle-BorderWidth="200" with my column turning black.
ControlStyle-Width="200" with no apparent results.

Any help would be appreciated.

--
Thanks in advance,

sck10

Snippet:
--------
<!-- GridView: Show list of web documents -->
<asp:GridView ID="gvWebDocList" Runat="server" DataSourceID="dsWebDocList"
AutoGenerateColumns="False" AllowPaging="True" PageSize="40"
PagerSettings-Mode="Numeric"
CellPadding="3" HeaderStyle-HorizontalAlign="Center"
CssClass="sckArial_BlkM08"
RowStyle-CssClass="sckArial_BlkM08"
HeaderStyle-CssClass="sckArial_BlueB08"
HorizontalAlign="Left"
BorderWidth="1px"
RowStyle-BorderColor="#000000" RowStyle-BorderStyle="Solid"
GridLines="Both">
<Columns>
<asp:BoundField HeaderText="Doc Group" DataField="strWebDocGroup" />

<asp:BoundField HeaderText="Doc Type" DataField="strWebDocType" />

<asp:HyperLinkField
HeaderText="Title"
DataTextField="strWebAddress"
DataNavigateUrlFields="strWebAddress"
SortExpression="strWebAddress" />

<asp:TemplateField
headertext="Submitter">
<itemtemplate>
<a
href='mailto:<%#Eval("strOwnerEmail")%>'><%#Eval(" strSubmitter")%></a>
</itemtemplate>
</asp:TemplateField>

</Columns>
</asp:GridView>

Nov 18 '05 #2
Hi Sck10,

I think Alex's suggestion is reasonable , generally in the asp.net 1.1's
DataGrid, we can use the
"HeaderStyle-Width" or "ItemStyle-Width" to adjust the columns's width(
both should ok). For example:

<asp:BoundColumn HeaderStyle-Width="100"></asp:BoundColumn>
<asp:BoundColumn ItemStyle-Width="100"></asp:BoundColumn>

I think the GridView may have the same behavior. You may have a try to see
whether they work. If there're any other problems, please feel free to post
here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Nov 18 '05 #3
Hi Sck10,

Have you had a chance to check the suggestions in my last reply or have you
got any further ideas on this issue? If there're anything else we can help,
please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #4

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

Similar topics

5
by: nimdez | last post by:
Hi, I am working on an existing code base in which a lot of data displayed to the user is formatted in tables. Most tables are printed row-by-row using printf() with "%s" print conversion...
2
by: Sunny | last post by:
I am dealing with this problem for some time now, i want to find out if there is a way to change the Column widths of DataGrid based on the the maximum size of the cell (content) for that column, or...
7
by: What-a-Tool | last post by:
Have an Access table loaded into a DataTable that was created at run time, and am displaying these contents in a data grid. Me.dgGames.DataSource = Me.DsGameInfo.Tables("Games") I would like to...
2
by: Byron O'Neal | last post by:
Using Visual Basic .net 2003 How do I set column widths of a GridControl when a form loads? Thanks for any assistance Byron
1
by: KC | last post by:
Can datagrid column widths be set individually? In the code that is. Ken
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
2
by: Midsomer | last post by:
Hi. I have an Access database with a form containing 4 datasheets and I allow the user to change column widths. On closing the form, a routine is fired that saves each column width to an INI file....
2
by: jakeesgirl | last post by:
I'm creating a C# program in Visual Studio. When I query the sql database, the results are put into a data grid view. However, the column widths are always too small when displayed. I have text that...
6
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.