Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid validation and aligning controls 1

Status
Not open for further replies.

redheadpgr

Programmer
Feb 8, 2002
17
0
0
US
I'm using template columns in a datagrid so that a user can edit data when they select "edit".

The problem I'm having is when I've added some validation controls. Not all the columns have validation controls. The ones that do, have the text boxes align differently in the cells from ones that don't have validation controls.

Is there a way to align these textbox controls in a row so that all would align at the top of the row?

Here is a sample of the code I'm using in a typical template column:

<asp:TemplateColumn HeaderText="Date">
<ItemTemplate>
<%# (DataBinder.Eval(Container.DataItem, "trans_dte")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtDateUpdate" Runat=server Width=80 Text='<%# DataBinder.Eval(Container.DataItem, "trans_dte") %>'/> <asp:RequiredFieldValidator Runat="server" ErrorMessage="Date Required" ControlToValidate="txtDateUpdate" />
<asp:CompareValidator Runat="server" ErrorMessage="Must be in format mm/dd/yyyy" Type="Date" ControlToValidate="txtDateUpdate" Operator="DataTypeCheck" />
</EditItemTemplate>
</asp:TemplateColumn>

Thanks in advance for any help.
 
Validator controls have a property for Display

You can choose dynamic or static.

Set them to dynamic, and they won't take up space until they are shown.

-p

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top