Accessing Form Elements through User Controls using AJAX

Joined
Nov 8, 2006
Messages
1
Reaction score
0
Hi guys,

I wondered if anyone could help me with this problem, or even shed some light on the direction I need to take to resolve it? I'm using .NET 2.0 (C# flavor) to build a large user-based website.

I've created an AJAX based user control, which is dynamically placed on a page (once, or multiple times) if the user has the correct permissions to receive it.

It contains two drop down lists - employee value and partner value; and a further date of birth selection user control which holds three additional drop down lists containing day, month and year.

I've managed to make the employee and partner value dropdowns dynamically update a value field via AJAX whenever the onchange event is called (again which has to be created dynamically as there can be multiple user controls on one page and I use ClientID to retreive the correct ID of the element). It passes the values of the five fields via a pipe delimited string list (eg: 500|10|2006|08|30) to the AJAX and it updates. Successfully, I'm pleased to add.

However, I'm having difficulty making the same onchange events of the date user control also update the value via AJAX. Despite passing the same code to use each of the date drop down lists, I receive an Javascript error telling me that the ID of the employee value (the first item called in the onchange event) does not exist. I can see it on the page, it is exactly the same event and calls the same name as the employee dropdown, yet it says it doesn't exist.

I think this error is something to do with how the date field in a separate User Control is unable to wire up to the Employee/Partner dropdown values to process the script, even though in Source mode the object exists. The Javascript error I'm receiving is:

Error: ctl00_cphContent_ctl00_ctl00_ddlEmployeeValue is not defined
Source file: http://computername/WebResource.axd...0yJ-T9vcwP8T9_KFWtOLGHQ1&t=632961828600156250
Line: 97

This line in WebResource is within 'function ValidatorHookupEvent(control, eventType, functionPrefix)'

Has anyone got any ideas, or explanation as to why this is happening?
 

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,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top