From: Ujjaval S. <uj...@gm...> - 2006-06-18 06:06:32
|
Hello everyone, I was looking at the DataList.aspx example in new Anthem.NET .NET 2.0 examples. I want to use validation control in DataList control. So, I've put it inside <EditItemTemplate> of DataList control.I've also specified validation group. But it doesn't work. Any suggestions on how to make validation control work in DataList control. Below is part of the code where I've made changes for adding validation control: <EditItemTemplate> Name: <asp:TextBox ID="name" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "name") %>' /> <br /> Validation Message: <asp:RegularExpressionValidator ID="nameValidation" ValidationGroup="nametest" runat="server" ErrorMessage="ONLY ENTER NAME" ControlToValidate="name" ValidationExpression="^[a-zA-Z'.\s]{1,10}$" /> <br /> Birthdate: <asp:TextBox ID="birthdate" runat="server" Text='<%# ((DateTime)DataBinder.Eval(Container.DataItem, "birthdate")).ToShortDateString() %>' /> <br /> <anthem:LinkButton ID="update" runat="server" CausesValidation="true" ValidationGroup="nametest" CommandName="Update" Text="Update" /> <anthem:LinkButton ID="cancel" runat="server" CommandName="Cancel" Text="Cancel" /> </EditItemTemplate> I guess everyone has Anthem.NET examples for .NET 2.0. Just in case if someone don't have, I've attached the file with this mail. Thanks in advance, Ujjaval -- Ujjaval Suthar Mobile : +61 - 0431 152 757 |