Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 25th, 2004, 02:34 AM
Authorized User
Join Date: Sep 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default About data grid


 I am working to deveolp a disscussion forum , I am willing to use a data grid.

Now what I want to ask how can I make the size of the coulmns fix and different from each other , I mean the size of the coulmn of "Topic/Title" is larger then the size of the coulmns like "Replies" Or "Views" etc.
Also how to keep the size fix, not exceeding from certain number of characters.

Please let me know any URL for any basic tutorial.
I will be very thank full to you all.

Old November 25th, 2004, 07:06 AM
Authorized User
Join Date: Nov 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts

well i'm facing the same problem in my application?
i would like to ask instead of fixing the size if the column if we can put the datagrid in a control that has a limited size on the page but has also a scrolbar if the datagrid take a larger size.
THANKS for your help.

Georges M. Kaddoum
Old November 25th, 2004, 08:36 AM
Friend of Wrox
Join Date: Sep 2003
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts

    it sounds like you have the AutoGenerate columns property set
true on your datagrid. If you set this as false you can then go to
the HTML tab on your Vis studio and manually add in bound data columns. You can set their header and item widths to be fixed sizes.
You can also create new columns using ASP/HTML column
templates. Here is some example code:

<asp:datagrid id="gridSR" style="Z-INDEX: 103; LEFT: 0px; POSITION: absolute; TOP: 272px" runat="server"Width="665px" Height="64px"
ForeColor="Blue" Font-Size="Smaller" BorderStyle="Ridge" BorderWidth="5px" BorderColor="ActiveBorder" AllowPaging="True" HorizontalAlign="Left" OnItemCommand="DoDetail" AutoGenerateColumns="False" PageSize="100" SelectedIndex="0">
<AlternatingItemStyle BackColor="#FFFFC0"></AlternatingItemStyle>
<HeaderStyle BorderStyle="Ridge" BackColor="#E0E0E0"></HeaderStyle>
<asp:TemplateColumn HeaderText="Detail">
  <asp:Button Text="Detail" Runat="server" Width="35"
    ForeColor="#3300ff" Font-Size="7"
<asp:BoundColumn DataField="tablefield1" HeaderText="Column 1" HeaderWidth="40">
<HeaderStyle Wrap="False" HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<asp:BoundColumn DataField="tablefield2" HeaderText="Column 2">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<asp:BoundColumn DataField="tablefield3" HeaderText="Column 3">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>

Hope this helps

Old December 1st, 2004, 11:14 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

You can put any HTML inside a <div> tag and set the style of the div to contain "overflow:auto;" and the contents will scroll if it gets larger than the size of the div. You'll need to set an explicit size for the div so that scrolling takes affect.

<div style="overflow:auto;height:400px;width:400px;">
Old December 9th, 2004, 05:42 AM
Friend of Wrox
Join Date: May 2003
Posts: 229
Thanks: 0
Thanked 0 Times in 0 Posts

You can browse a 16 part series of articles by Scott Mitchell on almost everything datagrids at the following url


Charul Shukla

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sort data in a data grid? zaheerabbas.sk ASP.NET 1.0 and 1.1 Basics 3 April 10th, 2007 02:37 PM
Export data from data grid to excel pomoc VB.NET 2002/2003 Basics 0 December 16th, 2005 03:11 PM
Export data from data grid to Excel pomoc Visual Basic 2005 Basics 0 December 16th, 2005 02:56 PM
trying to load db data into data grid itsajourney Beginning VB 6 2 June 7th, 2005 12:05 PM
Data Grid tsimsha Classic ASP Databases 3 October 5th, 2004 07:26 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.