I have date picker user control which is placed on master page. when i run application on local machine popup appears to select date and on production server i was able to select date in IE. Now all of sudden date popup is not coming on production server when i debug that application on production server it gives uncaught exception.I get exception in below javascript
var formname = document.getElementById(txtBox).form.name;
I get nothing in formname variable but same is working before and on local machine. difference i found was ctl00_ prefix was coming on local machine while on production server ctl00 prefix is not coming now so what could be the reason?
I am using ASP.net 2.0 framework. below is my code
Asp.net code :
<asp:textbox id="tbDate" runat="server" Width="104px" CssClass="clsTextBox">
<asp:Image id="imgCal" Visible="True" runat="server" ImageUrl="../images/calendar.jpg"/>
Code Behind:
protected override void OnPreRender(EventArgs e)
{
tbDate.Attributes.Add("onkeypress", "javascript:return WriteProtect()");
imgCal.ImageUrl = "../images/calendar.jpg";
imgCal.Attributes.Add("onclick", "javascript:cbfshowcalendar('" + imgCal.ClientID + "','" + tbDate.ClientID + "');event.cancelBubble=true;");
if(!Page.ClientScript.IsStartupScriptRegistered("CalendarJS"))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "CalendarJS", "<script type='text/javascript' src='../include/calendar.js'></script>");
}
}
Javascript :
function cbfshowcalendar(imgObj, txtBox)
{
var objname = txtBox;
var imgname = imgObj;
var formname = document.getElementById(txtBox).form.name; -- gets nothing in formname
var x=findPosX(eval("document.all." + imgname));
var y=findPosY(eval("document.all." + imgname));
var max_x = window.screen.width;
var max_y = window.screen.height-100;
. . . .
function cbfloadmefirst(formname, objname)
{
var tempObj;
var tempDate;
tempObj = eval("document." + formname + "." + objname); -- error on this line
Tags
What I have tried:
i found was ctl00_ prefix was coming on local machine while on production server ctl00 prefix is not coming now so what could be the reason?