Search Persits Software Knowledge Base

 

Article PS01111375

HOWTO: Setting fonts and colors for edit controls using CSS

Problem Summary

This article explains how to set fonts for text boxes in the edit mode with AspGrid.

Solution

To specify font face, color, alignment, size and other attributes for text boxes and other input controls in the edit mode, you must use Cascading Stylesheets (CSS).

Define a stylesheet for your page in the header section. Then specify the CLASS attribute via the property InputUserAttributes for the columns you need to apply this class to. For example:

<HTML>
<HEAD>

<STYLE TYPE="text/css">
<!--
.myfont { background: yellow; font-family: courier new;
  font-size: 8pt; text-align: right;}
-->
</STYLE>

...
</HEAD>
<%
...
Grid.Cols(2).InputUserAttributes = "CLASS=myfont"
...
%>

The example above defines the class .myfont and includes the attribute CLASS=myfont in all the tags <INPUT TYPE=TEXT> for column 2 of the grid in the edit mode. The resultant grid in IE may look like this:

Created: 2/8/2002 5:03:26 AM
Last Modified: 2/9/2002 4:24:27 PM

Copyright © Persits Software, Inc. 1998 - 2018
For technical support, write to support@persits.com.