473,382 Members | 1,648 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Calender Popup

I have a imagebutton that when you click on it, it will open up a page
containing a calender. When the pages starts up it gives the error
Object reference not set to an instance of an object.
and it highlights the line control.value =
Request.querystring("textbox").ToString()

Here is the my code
Public Class _popcal
Inherits System.Web.UI.Page
Protected WithEvents thedate As System.Web.UI.WebControls.Calendar
Protected WithEvents control As
System.Web.UI.HtmlControls.HtmlInputHidden

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 Calendar1_SelectionChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
Dim script(4) As String
script(1) = "<script>window.opener.document.forms[0]." +
control.Value + ".value = '"
script(2) = thedate.SelectedDate.ToString("dd/MM/yyyy")
script(3) = "';self.close()"
script(4) = "</" + "script>"
RegisterClientScriptBlock("test", Join(script, ""))
End Sub
End Class

Feb 7 '06 #1
5 1286
"MasterChief" <co*******@mix-net.net> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have a imagebutton that when you click on it, it will open up a page
containing a calender.
How does it open the page?
When the pages starts up it gives the error
Object reference not set to an instance of an object.
and it highlights the line control.value =
Request.querystring("textbox").ToString()
Are you actually passing the querystring that you're expecting? E.g. if the
calendar page is called calendar.aspx, are you doing something like:

Response.Redirect("calendar.aspx?textbox=1") or whatever?
control.Value = Request.QueryString("textbox").ToString()


Put a breakpoint on the above line, run the app in debug mode and
interrogate the value of your querystring - I'm willing to bet you're not
actually including a querystring in your hyperlink to the calendar page...
Feb 7 '06 #2
The way I am calling it is below. As you can see after popcal.aspx
there is ?textbox=txtStartDate
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
RegisterStartupScript("openWindow", "<script
language='javascript'>window.open('popcal.aspx?tex tbox=txtStartDate','Calendar','toolbars=0,scrollba rs=1,width=600,height=400,left
= 100,top = 100');</" & "script>")
End Sub

Feb 8 '06 #3
"MasterChief" <co*******@mix-net.net> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
The way I am calling it is below. As you can see after popcal.aspx
there is ?textbox=txtStartDate
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
RegisterStartupScript("openWindow", "<script
language='javascript'>window.open('popcal.aspx?tex tbox=txtStartDate','Calendar','toolbars=0,scrollba rs=1,width=600,height=400,left
= 100,top = 100');</" & "script>")
End Sub


Ah - now we're getting somewhere! What exactly is txtStartDate? Are you
trying to pass the name of a control or the value that control contains...?
Feb 8 '06 #4
It is the name of the textbox. What you do in the examples I have seen
is you have multple textboxes on a screen. What you do is when you open
a calender using a link you pass the name of the textbox. That way when
you click on a date in the calender it will know which textbox to
change on the main form.

Feb 8 '06 #5
"MasterChief" <co*******@mix-net.net> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
It is the name of the textbox. What you do in the examples I have seen
is you have multple textboxes on a screen. What you do is when you open
a calender using a link you pass the name of the textbox. That way when
you click on a date in the calender it will know which textbox to
change on the main form.


I understand. So how are you referring to this textbox in your calendar
form? Presumably something like window.opener...?
Feb 8 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: PerryC | last post by:
I want to be able to accomplish this, please help: When click on the DOB field, a ActiveX Calender popup and the user choose a date, the value is automatically refreshed in the DOB field in the...
4
by: Chris | last post by:
Hi, I am trying to create a popup calender so a user can click on a button on the main form, a calender will then popup, the user will select a date and then click ok on the popup. The date will...
3
by: shaam | last post by:
hi i have a webform with an image and a text box in it if i click that image a popup calender should appear... if i select the date,that date should come into the text box... and the the popup...
0
by: kalichakradhar | last post by:
hi all, hi, I am developing a application which would open the shared calender of outlook and read the meeting notices and also modifies the meeting notice from Vb.I am successful in opening the...
0
by: gopi2ks | last post by:
hi one and all i have one hyper link (birthday) and textbox (txt_birthday) when i click the hyperlink(birthday) it has to open one popup window with a calender, when i click the calender...
2
by: sathyamoorthy | last post by:
can any one give me the vb script to create popup window to display the calender in asp.net web application
1
by: Doug | last post by:
Hi, How do I get a Calender Control popup to appear near the button which activated it, rather than on the other side of the screen? (MS Access 2000)
1
by: moksha | last post by:
hi friends, In my application i have date field.To enter date i want to calender control. When i keep my cursor on textbox calender should popup and the selected value in calender has to...
1
by: vp.softverm | last post by:
hi all . Am facing problem with the date picker. when i click on date picker in a popup window. the date table is opened in the middle of the pop up window. and it is unable to scroll with...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.