Sign in | Join
Last post 09-09-2009 1:22 PM by panwt. 6 replies.
Sort Posts: Oldest to newest Newest to oldest
How can I put asp.net validation control in the ajax tab control? Need your help!
Thanks in advance!
<%@ Page Language="C#" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="422px" Width="733px"> <cc1:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1"> <ContentTemplate> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator> </ContentTemplate> </cc1:TabPanel> <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2"> <ContentTemplate> <asp:Button ID="Button2" runat="server" Text="Button" /> </ContentTemplate> </cc1:TabPanel> <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3"> <ContentTemplate> <asp:Button ID="Button3" runat="server" Text="Button" /> </ContentTemplate> </cc1:TabPanel> </cc1:TabContainer> </div> </form> </body> </html>
Hi Lance,
Sorry, my question maybe not correct. It should be how I can validate the data between the tab navigation using asp.net validation control. I only found one solution form the web, here is the link: http://www.bennedik.de/2008/09/validation-in-aspnet-ajax-control.html
Is there any better way other than that?
Thank you very much for your help!
Hi panwt
As your post, I think the solution which provided by Martin Bennedik is very good, you can use Validation Group, just as Vince Xu’s post here: http://forums.asp.net/t/1308716.aspx#2577619
Thanks.
Thank you, Lance!
I have gone through http://www.bennedik.de/2008/09/validation-in-aspnet-ajax-control.html. Good article but it didn't solve my problem though.
what if the user decides to click on the tabs instead of the buttons to navigate back and forth. How do I validate in that case?
Thanks in advance
Then you can use case 1 in the article to do the validation for all pages when you click the save button that you have to (must) put it out side of tab control.