Hi Moondaddy,
From the code and page template snipet you provided, you used the ASP.NET
Table control to contain the TextBoxes and Validator controls. There is a
potential problem that if you add ASP.NET table control first and then add
the TextBoxes into its cell directly by code the html tag such as
<asp:TextBox ...> in the aspx page template, then when you change to the
codebehind, the IDE won't generate page member for the Textboxes you added
in the ASP.NET Table control. I'm not sure whether this is the cause of the
problem, but you can have a check in the page's code behind to see whether
there is the member declaraion for the TextBox control which validation
control it to validate. Also, I also suggest you try the "HtmlTable"
Control just the
<table id="" runat=server> , that'll be more familiar with use, do you
think so.
As for to disable(make a validator control not work both serverside or
clientside), I think set its Enabled property as false is enougth. So if
this not work, there must be something else cause the problem. In addition,
below is a demo page I tested on my side, you can have a test on it on your
side and compare with your page to see whether it can provide any clues.
--------------------------aspx page-----------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>RequiredValidator</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="
http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="100%" align="center">
<tr>
<td>
<asp:LinkButton id="lnkTabOne" runat="server">TabOne</asp:LinkButton>
</td>
<td>
<asp:LinkButton id="lnkTabTwo" runat="server">TabTwo</asp:LinkButton>
</td>
<td>
<asp:LinkButton id="lnkTabThree"
runat="server">TabThree</asp:LinkButton>
</td>
</tr>
<tr>
<td colspan="3">
<table width="100%" align="center" id="tbOne" runat="server">
<tr>
<td>
TextBox1:<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator id="rfv1" runat="server"
ErrorMessage="TextBox1 Empty"
ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
<table width="100%" align="center" id="tbTwo" runat="server">
<tr>
<td>
TextBox2:<asp:TextBox id="TextBox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator id="rfv2" runat="server"
ErrorMessage="TextBox2 Empty"
ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
<table width="100%" align="center" id="tbThree" runat="server">
<tr>
<td>
TextBox3:<asp:TextBox id="TextBox3" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator id="rfv3" runat="server"
ErrorMessage="TextBox3 Empty"
ControlToValidate="TextBox3"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Button id="btnSubmit" runat="server" Text="Submit"></asp:Button>
</td>
</tr>
</table>
</form>
</body>
</HTML>
------------------code beind page class-----------------------
Public Class RequiredValidator
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents lnkTabOne As System.Web.UI.WebControls.LinkButton
Protected WithEvents lnkTabTwo As System.Web.UI.WebControls.LinkButton
Protected WithEvents lnkTabThree As System.Web.UI.WebControls.LinkButton
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox
Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button
Protected WithEvents rfv1 As
System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents rfv2 As
System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents rfv3 As
System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents tbOne As System.Web.UI.HtmlControls.HtmlTable
Protected WithEvents tbTwo As System.Web.UI.HtmlControls.HtmlTable
Protected WithEvents tbThree As System.Web.UI.HtmlControls.HtmlTable
Protected WithEvents txtServer As System.Web.UI.WebControls.TextBox
'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
SetCurrentTab(1)
End If
End Sub
Protected Sub SetCurrentTab(ByVal index As Integer)
tbOne.Visible = False
tbTwo.Visible = False
tbThree.Visible = False
rfv1.Enabled = False
rfv2.Enabled = False
rfv3.Enabled = False
Select Case index
Case 1
tbOne.Visible = True
rfv1.Enabled = True
Case 2
tbTwo.Visible = True
rfv2.Enabled = True
Case 3
tbThree.Visible = True
rfv3.Enabled = True
End Select
End Sub
Private Sub lnkTabOne_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lnkTabOne.Click
SetCurrentTab(1)
End Sub
Private Sub lnkTabTwo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lnkTabTwo.Click
SetCurrentTab(2)
End Sub
Private Sub lnkTabThree_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lnkTabThree.Click
SetCurrentTab(3)
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
Response.Write("<br>Page is submited at: " +
DateTime.Now.ToLongTimeString())
End Sub
End Class
----------------------------------------------------------------------------
-
If you have anything unclear or have any other questions, please feel free
to post here.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx