Leading Spaces in Text box so Required field validator not firing

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi all
I am having a radio buton has three lists. If i Select radio button other than TestOK. It should fire Textbox required field validation. but the text box having default leading spaces so the required field validation is not firing as it is taking textbox space as one caharcter.
Please help to solve this <asp:TableCell>
<asp:RadioButtonList ID="radio1" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" >
<asp:ListItem Value="0" Text="TestOK </asp:ListItem>
<asp:ListItem Value="1" Text="TestDenied </asp:ListItem>
<asp:ListItem Value="2" Text="testRecycle </asp:ListItem>
</asp:RadioButtonList>&nbsp;&nbsp;
<asp:RequiredFieldValidator ID="Reqselection" CssClass="red" runat="server" ControlToValidate="radio1" ValidationGroup="val1" ErrorMessage="Selection Required" Display="Dynamic" EnableClientScript="true" ></asp:RequiredFieldValidator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow CssClass="left
<asp:TableCell VerticalAlign="Top Text Comments:</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txtComment1" runat="server" Rows="5" Columns="50" TextMode="MultiLine" ToolTip="Enter a comment" EnableViewState="true </asp:TextBox>
<asp:RequiredFieldValidator ID="reqcomment" CssClass="red" runat="server" ControlToValidate="txtComment1" ValidationGroup="val1" ErrorMessage=" comments is required" Display="Dynamic" EnableClientScript="true </asp:RequiredFieldValidator>

</asp:TableCell>

View the full article
 
Back
Top