Change Font Size in Edit textbox for Datagrid?

Discussion in 'ASP .Net' started by Guest, May 24, 2005.

  1. Guest

    Guest Guest

    Pulling my hair out here!
    I have a datagrid with a number of bound columns (NOT template columns).
    When choosing to Edit, the textboxes appear, but the font is not the same as
    the original text (i.e., 8pt Tahoma).

    Anyone know how to change the Font size when the Edit box appears?
    I've tried setting up something with CSS and various changes in code, but I
    can't get anything to work.

    Perhaps I'm missing something simple?
    Appreciate any sample/example or suggestions>

    Thanks.
     
    Guest, May 24, 2005
    #1
    1. Advertisements

  2. Guest

    Brock Allen Guest

    You should be able to set the Style for your <EditItemStyle> which could
    be different than your <ItemStyle>
     
    Brock Allen, May 24, 2005
    #2
    1. Advertisements

  3. Guest

    vgebrev

    Joined:
    Jan 30, 2008
    Messages:
    2
    Likes Received:
    0
    This is in case someone else stumbles upon this page in search of a solution for the problem.

    You can manipulate the edit text box in the OnItemCreated event handler, like so:

    if (e.Item.ItemType == ListItemType.EditItem)
    {
    TextBox textBox = e.Item.Cells[0].Controls[0] as TextBox;
    //change the style as you see fit
    }

    In the example above, textBox would reference the box in the first column/cell of the row being edited.
     
    vgebrev, Jan 30, 2008
    #3
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.