By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,136 Members | 2,135 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,136 IT Pros & Developers. It's quick & easy.

Accessing Form Elements through User Controls using AJAX

P: 4
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?d=XRxrUjVsypu8znX1IiRn0yJ-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?
Nov 7 '06 #1
Share this Question
Share on Google+
1 Reply

P: 4
Don't mean to post again, but afraid I'll get lost among all those posts above me.

Is anyone able to shed any light on why this may be happening, even if they don't know the solution?
Nov 8 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.