We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Asp.Net 2.0 popup calendar

I was trying to generate a popup calendar(same as DateTimePicker control in vb.net) in Asp.net2.0. But I was not able to populate date from popup calendar window into the main form. I kept getting the error Microsoft JScript runtime error: 'window.opener.document.forms.0.StartDateTextBox' is null or not an object Can anyone please correct the error in the following code. Any help would be greatly appreciated. I am using the following code. Main form -------------- <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="default.aspx.vb" Inherits="default" title="Untitled Page" %>
date
--------------------------- DatTimePicker.aspx ---------------------------- <%@ Page Language="VB" AutoEventWireup="false" CodeFile="DatTimePicker.aspx.vb" Inherits="DatTimePicker" %> Calendar
---------------------------------------------------- DatTimePicker.aspx.vb ---------------------------------- Imports System.Web.UI.HtmlControls.HtmlGenericControl Partial Class DatTimePicker Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load control.Value = Request.QueryString("textbox").ToString() End Sub Protected Sub calDate_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles calDate.SelectionChanged Dim strScript As String = "" If (Not Page.ClientScript.IsClientScriptBlockRegistered(Me.GetType(), "DateTimeScript")) Then Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "DateTimeScript", strScript) End If End Sub End Class Thanks.

5 Replies

PO Poornima June 8, 2006 06:51 AM UTC

Hi , use the following code In MainPage.aspx In DatePicker.aspx DatePicker
In DatePicker.vb file Private Sub DatePicker_DayRender(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles _ Dim hl As New HyperLink() hl.Text = CType(e.Cell.Controls(0), LiteralControl).Text hl.NavigateUrl = "javascript:SetDate(''" & e.Day.Date.ToShortDateString() & "'');" e.Cell.Controls.Clear() e.Cell.Controls.Add(hl) End Sub Thanx


AD Administrator Syncfusion Team June 14, 2006 11:52 AM UTC

> >I was trying to generate a popup calendar(same as DateTimePicker control in vb.net) in Asp.net2.0. But I was not able to populate date from popup calendar window into the main form. > >I kept getting the error > >Microsoft JScript runtime error: 'window.opener.document.forms.0.StartDateTextBox' is null or not an object > > >Can anyone please correct the error in the following code. > >Any help would be greatly appreciated. > >I am using the following code. > >Main form >-------------- > ><%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="default.aspx.vb" Inherits="default" title="Untitled Page" %> > > > > > > > >
> > > >date >
>
> >--------------------------- > >DatTimePicker.aspx >---------------------------- > ><%@ Page Language="VB" AutoEventWireup="false" CodeFile="DatTimePicker.aspx.vb" Inherits="DatTimePicker" %> > > > > > > Calendar > > >
> NextPrevFormat ="ShortMonth" /> > > > > >---------------------------------------------------- > >DatTimePicker.aspx.vb >---------------------------------- > >Imports System.Web.UI.HtmlControls.HtmlGenericControl > >Partial Class DatTimePicker > Inherits System.Web.UI.Page > > Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load > control.Value = Request.QueryString("textbox").ToString() > End Sub > > Protected Sub calDate_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles calDate.SelectionChanged > Dim strScript As String = "" > > If (Not Page.ClientScript.IsClientScriptBlockRegistered(Me.GetType(), "DateTimeScript")) Then > > Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "DateTimeScript", strScript) > End If > End Sub >End Class > >Thanks.


AD Administrator Syncfusion Team June 21, 2006 08:12 AM UTC

I want to add DateTimePicker Control to my aspx page in .Net 2005 . But its toll box is not enable. Can you tell my how to add DateTimePicker in Asp.net 2.0. It ask for some type Dilog Editor, Can guide me how to add DateTimePicker . Jayul


AD Administrator Syncfusion Team September 1, 2006 10:33 AM UTC



>
>I was trying to generate a popup calendar(same as DateTimePicker control in vb.net) in Asp.net2.0. But I was not able to populate date from popup calendar window into the main form.
>
>I kept getting the error
>
>Microsoft JScript runtime error: ''window.opener.document.forms.0.StartDateTextBox'' is null or not an object
>
>
>Can anyone please correct the error in the following code.
>
>Any help would be greatly appreciated.
>
>I am using the following code.
>
>Main form
>--------------
>
><%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="default.aspx.vb" Inherits="default" title="Untitled Page" %>
>
>
>
>
>
>
>
>

>
>

>
>date

>

>

>
>---------------------------
>
>DatTimePicker.aspx
>----------------------------
>
><%@ Page Language="VB" AutoEventWireup="false" CodeFile="DatTimePicker.aspx.vb" Inherits="DatTimePicker" %>
>
>
>
>
>
> Calendar
>
>
>

>> NextPrevFormat ="ShortMonth" />
>
>
>
>
>----------------------------------------------------
>
>DatTimePicker.aspx.vb
>----------------------------------
>
>Imports System.Web.UI.HtmlControls.HtmlGenericControl
>
>Partial Class DatTimePicker
> Inherits System.Web.UI.Page
>
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
> control.Value = Request.QueryString("textbox").ToString()
> End Sub
>
> Protected Sub calDate_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles calDate.SelectionChanged
> Dim strScript As String = ""
>
> If (Not Page.ClientScript.IsClientScriptBlockRegistered(Me.GetType(), "DateTimeScript")) Then
>
> Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "DateTimeScript", strScript)
> End If
> End Sub
>End Class
>
>Thanks.


LO lol February 3, 2008 04:35 AM UTC



>Hi ,
> use the following code
>
>In MainPage.aspx
>
>
>
>
>
>
>In DatePicker.aspx
>
>
>
>
> DatePicker
>
>
> > marginwidth="0" marginheight="0">
>

> > />
>
>
>
>
>In DatePicker.vb file
>
>Private Sub DatePicker_DayRender(ByVal sender As Object, _
> ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles _
>
> Dim hl As New HyperLink()
> hl.Text = CType(e.Cell.Controls(0), LiteralControl).Text
> hl.NavigateUrl = "javascript:SetDate('" & e.Day.Date.ToShortDateString() & "');"
> e.Cell.Controls.Clear()
> e.Cell.Controls.Add(hl)
>End Sub
>
>Thanx



Loader.
Live Chat Icon For mobile
Up arrow icon