Click to See Complete Forum and Search --> : asp.net Pop Up calendar : Giving Problems


matu
July 10th, 2003, 12:23 PM
I am designing a Calendar POp-Up Control.I click a button and a Pop-Up calendar appears and i select a date on it.This selection causes the selected date to appear in a Text Box.

But when i click on the date i donot find anything entered into the textbox.I donot know whats going on here.


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here



'THIS LINE GIVES ME AN ERROR
Hidden1.Value = Request.QueryString("textbox").ToString()

End Sub


"System.NullReferenceException: Object reference not set to an instance of an object."

matu
July 10th, 2003, 02:42 PM
Hi All ,
I have a problem with reading a Clicked Date from a Pop-Up Calendar.
I have the button and a Text Box in a WebForm.Clicking this button
pops up a calendar(which is a separate WebForm).
Selecting a Date on the WebForm transfers the selected Date to the
Text Box(on the Other WebForm).

In the "Code Behind" for the Calendar WebForm I have the following Code::

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
'THE FOLLOWING LINE GIVES ME AN ERROR -- IT SAYS THAT
'System.NullReferenceException: Object reference not set to an instance of an object.

Hidden1.Value = Request.QueryString("textbox").ToString()

End Sub


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

Dim strScript As String = "<script>window.opener.document.forms(0)." + Hidden1.Value + ".value = '"
strScript += Calendar1.SelectedDate.ToString("MM/dd/yyyy")
strScript += "';self.close()"
strScript += "</" + "script>"
RegisterClientScriptBlock("anything", strScript)

End Sub


iN THE paGE WHERE THE BUTTON IS CLICKED I HAVE THE FOLLOWING CODE IN THE html
PART

<INPUT name="textBox1" type="text" id="textbox1"> <INPUT type="button" runat="server" onclick="javascript:cal=window.open('Calender.aspx?textbox = textbox1','cal','width=800,height=800' );cal.setfocus()" value="Button" />

nOW WHAT IS THE WAY OUT?
HELP IS GREATLY APPRECIATED.tHANKS ,