formatting selected item in datagrid

T

TB

Hi All:

I hope that this is the right group for posting the following (newbie)
question:

Using VS.NET 2003 I have created a datagrid, where I want to ensure
that all text both when viewed AND when edited is displayed in Verdana
9px

This code goes like this:

<asp:DataGrid id="MyDataGrid" runat="server"
autogeneratecolumns="False" AlternatingItemStyle-BackColor="#C0C0C0"
AllowPaging="True" OnPageIndexChanged="PageChange"
OnEditCommand="EditDataGrid_Edit" OnCancelCommand="EditDataGrid_Cancel"
OnUpdateCommand="EditDataGrid_Update" PageSize="10"
Font-Name="Verdana" Font-Size="9px" HeaderStyle-BackColor="#88B5DA"
Width="100%">
<EditItemStyle Font-Name="Verdana"/>
<EditItemStyle Font-Size="9px"/>
<Columns>

(etc, etc)

Whereas all the viewable data is displayed in Verdana 9px, whenever I
try to edit something the letters inside the textboxes of the selected
item is displayed as something that looks like Arial 10px.

Any suggestions will be highly appreciated.

Thanks

TB
 
G

Guest

The textbox would not inherit the style for the EditItem (the latter is a
tablerow and the former is an input tag within the tablerow).

Try instead specifying a cssClass in the EditItemStyle. For example:
cssClass="MyEditItem", then in the Style section add

..MyEditItem TD{font-family:verdana;font-size:9px;}
 
T

TB

It worked. Thanks a lot.

A follow-up question: How can ensure that the column widths always
remain the same regardless of whether I am a view mode or in edit mode?

TB
 
G

Guest

You might want to follow up on questions of styling on:
comp.infosystems.www.authoring.stylesheets

However, you can define the styles of a column within the TemplateColumns
themselves, e.g.:
<asp:TemplateColumn >
<ItemStyle CssClass ="Column1ItemStyle"></ItemStyle>
<HeaderStyle cssClass="Column1HeaderStyle"></HeaderStyle>
<FooterStyle CssClass ="Column1FooterStyle"></FooterStyle>
<ItemTemplate >
<!-- place here your controls and HTML -->
</ItemTemplate>
<EditItemTemplate >
<!-- place here your controls and HTML -->
</EditItemTemplate>
<FooterTemplate >
<!-- place here your controls and HTML -->
</FooterTemplate>
</asp:TemplateColumn>
 

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

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top