|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a web form (default.aspx) that contains a user control which contains textboxes, a Calendar, buttons, and labels. That user control is named mUc_calendar. From this form (default.aspx), the user clicks a button (on the user control) and opens another form with a text box name (stored in mUc_calendar) in the query string (via a javascript function). From this popped up window, the user selects a date (via a Calendar control) and I'd like to populate a text box (via a javascript function) on the opening form (default.aspx) with the date the user selected on the Calendar pop up window (PopupCalendar.aspx) .
Let's say the textbox I want to populate with the date value is named 'tbxFrom' , how would I access 'tbxFrom' located in the user control mUc_calendar on default.aspx from the javascript function in PopupCalendar.aspx?? function SetDate(dateValue) { var pos = window.location.search.indexOf("="); var ctl = window.location.search.substr(pos+1); //this is how I think it might work, but can't get it to work!! //thisForm = window.opener.document.forms[0].mUc_calendar.elements [ctl].value = dateValue; self.close(); } I'm pretty new to javascript ![]() Thanks for any help on this dwicker |
|
#2
|
|||
|
|||
|
To access a child of a user control you must reference the id of the child with the id of the control appended to the front with a colon ie
document.Cart.elements['loginNewUser:TBFirstNameShp'].value = document.Cart.elements['loginNewUser:tbFirstName'].value ; Cart is my form loginNewUser is the id of my usercontrol TBFirstNameShp is the name of my child contrl If you look at the source for your asp.net page you will see that the child control is referenced with the usercontrol id appended to the front in this way. |
|
#3
|
|||
|
|||
|
hi
but how can we access the textbox in user control inside control only using javascript?? |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > accessing controls embedded in a user control via javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|