Hi,
I have run into a very strange scenario. In developing an ASP.NET
application on framework version 1.1, I found that certain client-side
validation scripts were not being rendered. The reason we came up with for
this was because we had a PageBase base class for all our pages. This base
class takes the controls on the child page class and places them onto the
form being rendered. It seems that in this process, the rendering of the
validation calls gets lost. To overcome this problem I added code to add the
required client-side function call on the "onclick" event of the necessary
buttons as follows:
<input type="submit" name="btnSave" value="Save" onclick="btnClose.enabled =
'false';if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();
if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="btnSave" class="button" style="width:68px;" />
Can anybody tell me if the original problem was a bug in the framework, IIS5
etc.? Also, if it was a framework bug, why does it differ with the same
version on WinXP Pro and Win2003 Server?
Any light on this subject will be greatly appreciated.
Fourge
btnSubmit.Attributes.Add("onclick","btnClose.enabl ed = 'false';if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); ");
After adding this, it worked great in our development and test environment.
Our development is done on Windows XP Pro with IIS5 and our testing on
Windows 2000 Server with IIS5. Both environments running .NET Framework 1.1.
One of the deployments we did was into the Windows 2003 Server environment.
Once th application was running in that environment, we found that the
validation function calls above were now being added and so we were getting
the javascript calls twice in the rendered html page as follows: