From: Ujjaval S. <uj...@gm...> - 2006-06-18 19:37:21
|
Hi Andy, Thanks for that. Server-side validation worked. But client-side validation still didn't work even after adding Anthem.Manager.IncludePageScripts=true both in firefox and IE. Any other thoughts why its not working? Does it work on your computer? Thanks, Ujjaval On 6/19/06, ant...@li... <ant...@li...> wrote: > Send anthem-dot-net-users mailing list submissions to > ant...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/anthem-dot-net-users > or, via email, send a message with subject or body 'help' to > ant...@li... > > You can reach the person managing the list at > ant...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of anthem-dot-net-users digest..." > > > Today's Topics: > > 1. Problem with validation control in DataList control > (Ujjaval Suthar) > 2. Problem with validation control in DataList control > (Ujjaval Suthar) > 3. Re: Problem with validation control in DataListcontrol > (Andy Miller) > 4. Re: Problem with validation control in DataListcontrol > (Andy Miller) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sun, 18 Jun 2006 16:06:30 +1000 > From: "Ujjaval Suthar" <uj...@gm...> > Subject: [Anthem.NET-users] Problem with validation control in > DataList control > To: ant...@li... > Message-ID: > <725...@ma...> > Content-Type: text/plain; charset="iso-8859-1" > > 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 > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: DataList.aspx > Type: application/xml > Size: 4673 bytes > Desc: not available > Url : http://sourceforge.net/mailarchive/forum.php?forum=anthem-dot-net-users/attachments/20060618/8d16b1bb/attachment.rdf > > ------------------------------ > > Message: 2 > Date: Sun, 18 Jun 2006 16:10:20 +1000 > From: "Ujjaval Suthar" <uj...@gm...> > Subject: [Anthem.NET-users] Problem with validation control in > DataList control > To: ant...@li... > Message-ID: > <725...@ma...> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > 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 > > > > ------------------------------ > > Message: 3 > Date: Sun, 18 Jun 2006 09:17:09 -0700 > From: "Andy Miller" <am...@st...> > Subject: Re: [Anthem.NET-users] Problem with validation control in > DataListcontrol > To: <ant...@li...> > Message-ID: <004501c692f2$a66b5230$0701a8c0@ANDYDESKTOP> > Content-Type: text/plain; charset="us-ascii" > > I'm not sure why the client side validation is not running, but you can > (should) also run the validation on the server by wrapping the update inside > of a check for IsValid like so: > > void dataList_UpdateCommand(object sender, DataListCommandEventArgs > e) > { > if (IsValid) > { > string name = > ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("name")).Text; > string birthdate = > ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("birthdate")).Text; > > TestData.Rows[e.Item.ItemIndex]["name"] = name; > TestData.Rows[e.Item.ItemIndex]["birthdate"] = > DateTime.Parse(birthdate); > > dataList.EditItemIndex = -1; > BindList(); > } > } > > Andy Miller > > > > > > > ------------------------------ > > Message: 4 > Date: Sun, 18 Jun 2006 09:24:11 -0700 > From: "Andy Miller" <am...@st...> > Subject: Re: [Anthem.NET-users] Problem with validation control in > DataListcontrol > To: <ant...@li...> > Message-ID: <004601c692f3$a21744e0$0701a8c0@ANDYDESKTOP> > Content-Type: text/plain; charset="us-ascii" > > Now I see it. Because you are adding the validation control during a > callback, new javascript is added to the page during the callback. Normally > Anthem.Manager ignores the scripts on the page. But you can tell it to > include the scripts in the callback response like so: > > void dataList_EditCommand(object sender, DataListCommandEventArgs e) > { > dataList.EditItemIndex = e.Item.ItemIndex; > BindList(); > Anthem.Manager.IncludePageScripts = true; > } > > Andy Miller > > > > > > > ------------------------------ > > > > ------------------------------ > > _______________________________________________ > anthem-dot-net-users mailing list > ant...@li... > https://lists.sourceforge.net/lists/listinfo/anthem-dot-net-users > > > End of anthem-dot-net-users Digest, Vol 1, Issue 197 > **************************************************** > -- Ujjaval Suthar Mobile : +61 - 0431 152 757 |