How set the size (width) of field in Datagrid

Discussion in 'ASP .Net' started by =?Utf-8?B?ZGF2aWQ=?=, Jul 20, 2005.

  1. How to set the size of a field in DataGrid?

    Right now the size is automatically set and determined by the size of the
    colunm name.

    Thanks

    David
     
    =?Utf-8?B?ZGF2aWQ=?=, Jul 20, 2005
    #1
    1. Advertising

  2. david wrote:
    > How to set the size of a field in DataGrid?
    >
    > Right now the size is automatically set and determined by the size of
    > the colunm name.
    >

    If using Visual Studio, just right-click the grid and fire up the Propery
    Builder, using the Format tab to modify the Column widths.

    Otherwise, add a HeaderStyle tag to the html:

    <asp:BoundColumn ... >
    <HeaderStyle Width="150px"></HeaderStyle>
    </asp:BoundColumn>

    HTH,
    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Jul 20, 2005
    #2
    1. Advertising

  3. This may be what you are looking for

    <Columns>
    <asp:BoundColumn DataField="EMPLOYEE_NUMBER"
    SortExpression="EMPLOYEE_NUMBER" HeaderText=" Employee ID ">
    <HeaderStyle HorizontalAlign="Center" Width="250px"
    VerticalAlign="Middle"></HeaderStyle>
    </asp:BoundColumn>
    </Columns>




    "david" wrote:

    > How to set the size of a field in DataGrid?
    >
    > Right now the size is automatically set and determined by the size of the
    > colunm name.
    >
    > Thanks
    >
    > David
     
    =?Utf-8?B?U3JlZWppdGggUmFt?=, Jul 20, 2005
    #3
  4. In addition to the other answers just note, that the browser considers your
    column width instructions only as recommendations. To force the browser to
    listen to you use css rule table-layout:fixed.

    Eliyahu

    "david" <> wrote in message
    news:...
    > How to set the size of a field in DataGrid?
    >
    > Right now the size is automatically set and determined by the size of the
    > colunm name.
    >
    > Thanks
    >
    > David
     
    Eliyahu Goldin, Jul 20, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AndrewF
    Replies:
    1
    Views:
    847
    Bruce Barker
    Oct 10, 2005
  2. Replies:
    1
    Views:
    757
    Beauregard T. Shagnasty
    Dec 29, 2007
  3. joy

    set datagrid width size

    joy, Mar 21, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    813
    Teemu Keiski
    Apr 15, 2007
  4. Replies:
    1
    Views:
    1,604
  5. RMZ
    Replies:
    2
    Views:
    214
    David Mark
    Aug 2, 2007
Loading...

Share This Page