HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 15th, 2003, 09:44 AM
dwicker dwicker is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 1 dwicker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to dwicker
Angry accessing controls embedded in a user control via javascript

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

Reply With Quote
  #2  
Old October 28th, 2003, 12:49 PM
ssauten ssauten is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 2 ssauten User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking

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.

Reply With Quote
  #3  
Old May 27th, 2004, 02:28 AM
bhatia_amrita bhatia_amrita is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 2 bhatia_amrita User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy

hi
but how can we access the textbox in user control inside control only using javascript??

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > accessing controls embedded in a user control via javascript


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT