- Home
- Forum
- ASP.NET Web Forms (Classic)
- Asp.Net 2.0 popup calendar
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" %>
--------------------------- 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.
|
SIGN IN To post a reply.
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" %> > > > > >
> > >--------------------------- > >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.
> > | >
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" %>
>
>
>
>
> > > > ![]() > |
>
>
>---------------------------
>
>DatTimePicker.aspx
>----------------------------
>
><%@ Page Language="VB" AutoEventWireup="false" CodeFile="DatTimePicker.aspx.vb" Inherits="DatTimePicker" %>
>
>
>
>
>
>
>
>
>
>
>
>----------------------------------------------------
>
>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
>
>
>
>
>
>
>
> > 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
SIGN IN To post a reply.
- 5 Replies
- 4 Participants
-
AM Amb
- May 1, 2006 06:29 PM UTC
- Feb 3, 2008 04:35 AM UTC
