Setting Date Value selected on Date Picker
<p>I'm trying to get a date picker on my asp.net webpage. I've been able to run the same code using a master page 
and it works, but now I'm trying to get it to work without a master pager and I'm getting error message:
Error: Unable to get value of the property 'aspnetForm.ctl00_txtDOB': object is null or undefined</p>

<p>On my Default.aspx page....</p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;
    function calendarPicker(strField) {
        window.open('date_picker.aspx?field=' + strField, 'calendarPopup', 'width=250,height=190,resizable=yes');
    } 


        &lt;label&gt;DOB:&lt;/label&gt;&lt;asp:TextBox ID="txtDOB" runat="server"&gt;&lt;/asp:TextBox&gt;
       &lt;img src="images/calendar.gif" alt="Pick To Date" onclick="calendarPicker('aspnetForm.ctl00_txtDOB');"/&gt;

      I already tried onclick="calendarPicker('txtDOB');"/&gt;


My date_picker.aspx.cs
        private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
        {

            // Clear the link from this day
            e.Cell.Controls.Clear();

            // Add the custom link
            System.Web.UI.HtmlControls.HtmlGenericControl Link = new System.Web.UI.HtmlControls.HtmlGenericControl();
            Link.TagName = "a";
            Link.InnerText = e.Day.DayNumberText;
            Link.Attributes.Add("href", String.Format("JavaScript:window.opener.document.{0}.value = \'{1:d}\'; window.close();", Request.QueryString["field"], e.Day.Date));




            // By default, this will highlight today's date.
            if (e.Day.IsSelected)
            {
                Link.Attributes.Add("style", this.Calendar1.SelectedDayStyle.ToString());
            }



            // Now add our custom link to the page
            e.Cell.Controls.Add(Link);

        }
</code></pre>
