Hi, I have an asp.net 2.0 form.
It is made up as follows
It has a master page
It has 2 custom controls.
In one of the custom controls I have a read only text box
I have a button here too that opens a popup calendar
I want to populate the text box with the value from the calendar... My javascript is as follows
function OpenCalendar(idname)
{
var popUp;
var MyArgs = new Array('A');
for (var i = 0; i < 20; ++i)
{
// alert(document.forms[0].elements.name.substr(0, idname.length))
}
//var newUrl= 'Calendar.aspx?selected=' + document.forms[0].elements[idname].value;
var newUrl = 'Calendar.aspx'
popUp = window.showModalDialog(newUrl, MyArgs, WinSettings);
if (popUp != null)
{if (popUp[0] !== 'CANCEL')
{
document.forms[0].elements[idname].value = popUp[0].toString();
}
}
However it never finds my textbox control to update.
the call to the javascript is
javascript:OpenCalendar('txtDateStart') for the textbox...
If i do a loop through all the document.forms[0].elements and print their name the name i get for this txtDateStart is: ctl00$ContentPlaceHolder1$EntertainmentAdminPanel1$txtDateStart
Am I doing sometihng wrong?
Do I have to pass this full name for it to work?
Thanks
It is made up as follows
It has a master page
It has 2 custom controls.
In one of the custom controls I have a read only text box
I have a button here too that opens a popup calendar
I want to populate the text box with the value from the calendar... My javascript is as follows
function OpenCalendar(idname)
{
var popUp;
var MyArgs = new Array('A');
for (var i = 0; i < 20; ++i)
{
// alert(document.forms[0].elements.name.substr(0, idname.length))
}
//var newUrl= 'Calendar.aspx?selected=' + document.forms[0].elements[idname].value;
var newUrl = 'Calendar.aspx'
popUp = window.showModalDialog(newUrl, MyArgs, WinSettings);
if (popUp != null)
{if (popUp[0] !== 'CANCEL')
{
document.forms[0].elements[idname].value = popUp[0].toString();
}
}
However it never finds my textbox control to update.
the call to the javascript is
javascript:OpenCalendar('txtDateStart') for the textbox...
If i do a loop through all the document.forms[0].elements and print their name the name i get for this txtDateStart is: ctl00$ContentPlaceHolder1$EntertainmentAdminPanel1$txtDateStart
Am I doing sometihng wrong?
Do I have to pass this full name for it to work?
Thanks