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. Advertising

  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. 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. San Diego Guy
    Replies:
    0
    Views:
    562
    San Diego Guy
    Aug 7, 2003
  2. Schultz
    Replies:
    3
    Views:
    576
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Feb 14, 2005
  3. Andreas Klemt
    Replies:
    0
    Views:
    320
    Andreas Klemt
    Oct 8, 2003
  4. Sharon McCarty
    Replies:
    0
    Views:
    261
    Sharon McCarty
    Nov 24, 2004
  5. Frank Kurka
    Replies:
    8
    Views:
    318
Loading...

Share This Page