Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Popup Calendar in Datagrid

Author  Topic 

ashy_16in
Starting Member

16 Posts

Posted - 2006-06-22 : 15:27:43
I get the following error when I try to populate the date in a textbox in a grid using a popup calendar.

Microsoft JScript runtime error: 'window.opener.Form1.DataGrid1__ctl4_TextBox1' is null or not an object

Any help would be greatly appreciated.

Here is the code I have used for the Datagrid Itembound event:

Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound

If e.Item.ItemType = ListItemType.EditItem Then

Dim drvview As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim strTextBoxName As String = e.Item.Cells(0).FindControl("TextBox1").ClientID()

CType(e.Item.FindControl("lbtnCalendar1"), HyperLink).NavigateUrl = "javascript:calendar_window=window.open('DGCal.aspx?formname=Form2." & strTextBoxName & "','DatePicker','width=250,height=190,left=360,top=180');calendar_window.focus();"

End If

End Sub


This is the code I have used in DGCal.aspx:

Public Sub Calendar1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged

Dim strjscript As String = "<script language=""javascript"">"
strjscript &= "window.opener." & _
HttpContext.Current.Request.QueryString("formname")
& ".value = '" & _
Calendar1.SelectedDate & "';window.close();"
strjscript = strjscript & "</scr" & "ipt>"
Literal1.Text = strjscript
End Sub
   

- Advertisement -