Validate problem

J

js

My form has only one RequiredFieldValidator (called RqValidateSerial)
enabled at design time. In the code behind I set the validatior to
false when the form is submitted by certain button click. On the same
IIS6 server, I use port :801 as my development site, and :80 as the
production site. Both sites has identical configuration. The
validation works fine. Then I use Windows Explore (without using
XCOPY) to copy the .ASPX, .ASPX.cs,
..ASPX.resx to the \myApp\forms directory on the production site. The
..DLL and .PDB files are also copied to the \myApp\bin directory. For
some reason the validator is always enabled when the form is submitted,
even the buton's CLICK event has code that disables the validtor. Does
anyone know why? The following is an example of one of the button that
disable the validator.

////code behind in .cs file
private void btnSubmitLookup_Click(object sender, System.EventArgs e)
{
try
{
RqValidateSerial.Enabled = false;

if (SelectedInventory == null) //disable the RequiredFieldValidator
{
SelectedInventory = new Inventory();
}
saveFormValueToSession();
saveCriteria();
Server.Transfer("CustomPaging.aspx");
}
catch(Exception ex)
{
handleError(ex);
}
}

//// code in .aspx file
<TR>
<TD><B>Serial:</B></TD>
<TD>
<asp:textbox id="txtSerial" runat="server"></asp:textbox>
<asp:imagebutton id="btnResetSerial" runat="server"
EnableViewState="False" ImageUrl="/images/Scissors1.GIF"
CssClass="smallIcon" CommandName="reset"
CommandArgument="txtSerial"></asp:imagebutton>
<asp:requiredfieldvalidator id="RqValidateSerial" runat="server"
Display="Dynamic" ControlToValidate="txtSerial"
ErrorMessage="Partial or complete serial number is
required"></asp:requiredfieldvalidator></TD>
</TR>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,787
Messages
2,569,632
Members
45,340
Latest member
Thalia56P0

Latest Threads

Top