From: Ujjaval S. <uj...@gm...> - 2006-06-18 06:17:30
|
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 need the full code for that page, let me know so that I can copy and send it. I tried to attach aspx file with this mail, but I had an error message from admin; so sent this message without the whole code. Thanks in advance, Ujjaval -- Ujjaval Suthar Mobile : +61 - 0431 152 757 |