Error when placing Validators on a DataList Control.

A

Art Kedroski

We are using .NET validators on most of our aspx pages.
When the validator is contained within a datalist (i.e.
the EditItemTemplate) the WebUIValidation.js file location
tag is not rendered on the page.

Missing Tag:
<script language="javascript"
src="/aspnet_client/system_web/1_0_3705_0/WebUIValidation.j
s"></script>

When we attempt to edit the item we receive the following
error message:

Error Message:
Unable to find script
library '/aspnet_client/system_web/1_0_3705_0/WebUIValidati
on.js'. Try placing the file manually.


If the validators are located directly on the page and not
in the datalist, the tag is rendered correctly.

1) We can hard code the path on each page but this creates
maintenance issues.

2) If we add a hidden field with a default value and a
required field validator on the page, the tag is
rendered. This is successful but not very clean.

I would like to do one of the following.

1) Trigger the rendering of this tag in code. I have been
unsuccessful in this regard.

2) Dynamically read the file location and render the tag.
I can read the cryptic path "/aspnet_client/{0}/{1}/"
from the machine.config file but I have been unsuccessful
translating it.

Dim configData As IDictionary = context.GetConfig
("system.web/webControls")
Response.Write(configData("clientScriptsLocation"))

We are currently running the .NET Framework 1.0 SP2. Any
thoughts would be greatly appreciated.

Thanks,
Art Kedroski
 
K

Krissy

Art Kedroski said:
We are using .NET validators on most of our aspx pages.
When the validator is contained within a datalist (i.e.
the EditItemTemplate) the WebUIValidation.js file location
tag is not rendered on the page.

Missing Tag:
<script language="javascript"
src="/aspnet_client/system_web/1_0_3705_0/WebUIValidation.j
s"></script>

When we attempt to edit the item we receive the following
error message:

Error Message:
Unable to find script
library '/aspnet_client/system_web/1_0_3705_0/WebUIValidati
on.js'. Try placing the file manually.


If the validators are located directly on the page and not
in the datalist, the tag is rendered correctly.

1) We can hard code the path on each page but this creates
maintenance issues.

2) If we add a hidden field with a default value and a
required field validator on the page, the tag is
rendered. This is successful but not very clean.

I would like to do one of the following.

1) Trigger the rendering of this tag in code. I have been
unsuccessful in this regard.

2) Dynamically read the file location and render the tag.
I can read the cryptic path "/aspnet_client/{0}/{1}/"
from the machine.config file but I have been unsuccessful
translating it.

Dim configData As IDictionary = context.GetConfig
("system.web/webControls")
Response.Write(configData("clientScriptsLocation"))

We are currently running the .NET Framework 1.0 SP2. Any
thoughts would be greatly appreciated.

Thanks,
Art Kedroski

Do you have Smart Navigation turned on? When I used to on my pages I got
this error all the time. I turned it off and the errors went away :)
 
A

Art Thomas

Thanks for the feedback. Unfortunately I still get the error popup.
Just to give you a little more history, the browser setting is essential
to recreating the popup error. However, the browser setting does not
affect the rendering of the tag into html. If the setting is changed,
the .js file is cached and the error does not occur. Under any of the
described scenarios, the tag does not get rendered.

Browser setting to recreate the issue: Tools / Internet Options /
Settings / Check for newer versions of stored pages Every visit to the
page.

Art Kedroski
 

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

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top