Change Font Size in Edit textbox for Datagrid?


G

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

Advertisements

B

Brock Allen

You should be able to set the Style for your <EditItemStyle> which could
be different than your <ItemStyle>
 
Ad

Advertisements

Joined
Jan 30, 2008
Messages
2
Reaction score
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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top