DataGrid Edit TextBox

Discussion in 'ASP .Net Datagrid Control' started by Aidal, Nov 3, 2005.

  1. Aidal

    Aidal Guest

    Hi NG.

    I'm having trouble controling the size of the textboxes that appear when the
    user clicks the "edit" button for a row in my datagrid.
    I know it can be done and I know it doesn't require much, but I just can't
    seem to find out how to anyway.

    If anyone could help me out with this little problem it would be much
    appreciated :)

    Thanks
    /Aidal
     
    Aidal, Nov 3, 2005
    #1
    1. Advertisements

  2. Aidal

    alvinz_c Guest

    Hi, Aidal, you have two ways to do it. If you are using the BoundColumn, then
    you can set the width of textbox in the ItemCreated event.

    protected void dgrd_ItemCreated(Object sender, DataGridItemEventArgs e)
    {
    if(e.Item.ItemType == ListItemType.EditItem)
    {
    TextBox txt = (TextBox)e.Item.Cells[X].Controls[0];
    txt.Width = < the width you want it to be>;
    }
    }

    Another way is set the TextBox's width declaractively in the TemplateColumn.


    Hope this helps....
     
    alvinz_c, Nov 9, 2005
    #2
    1. Advertisements

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. San Diego Guy
    Replies:
    0
    Views:
    742
    San Diego Guy
    Aug 7, 2003
  2. =?Utf-8?B?TmV3VG9Eb3ROZXQ=?=

    TextBox and DropDownList in Datagrid Edit mode

    =?Utf-8?B?TmV3VG9Eb3ROZXQ=?=, Jan 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    919
    =?Utf-8?B?TmV3VG9Eb3ROZXQ=?=
    Feb 9, 2004
  3. Schultz
    Replies:
    3
    Views:
    767
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Feb 14, 2005
  4. Yunus Emre ALPÖZEN [MCAD.NET]
    Replies:
    1
    Views:
    840
  5. =?Utf-8?B?QmxhaW5l?=

    Change Font Size in Edit textbox for Datagrid?

    =?Utf-8?B?QmxhaW5l?=, May 24, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    4,024
    vgebrev
    Jan 30, 2008
  6. Andreas Klemt
    Replies:
    0
    Views:
    502
    Andreas Klemt
    Oct 8, 2003
  7. Sharon McCarty
    Replies:
    0
    Views:
    412
    Sharon McCarty
    Nov 24, 2004
  8. Frank Kurka
    Replies:
    8
    Views:
    614
Loading...