How to use a javascript popup calendar in asp.net?

G

gnewsgroup

I know AjaxControlToolKit has a popup calendar control. It does not
seem to have a year navigation option. In other words, if I wanna
select a date in 1012, I will have to navigate to that year monthly
--- dozens of clicks in a row!

I prefer the free javascript popup calendar at

http://www.mattkruse.com/javascript/calendarpopup/

I tried it out. It works perfectly if I simply do it in a traditional
HTML page or a plain independent ASPX page. But, it does not work if
the ASPX page has a master page.

The error message is the kind of notorious Javacript error which says
that the thing referred to "is null or not an object".

It is hard to NOT to have a master page these days, right? So,
besides NOT using master pages, is there a solution to this problem?

Looks like the the javascript calendar script is not loaded if we use
master page, since it is complaining about null or non-object-hood.

Thank you.
 
G

gnewsgroup

I know AjaxControlToolKit has a popup calendar control. It does not
seem to have a year navigation option. In other words, if I wanna
select a date in 1012, I will have to navigate to that year monthly
--- dozens of clicks in a row!

I prefer the free javascript popup calendar at

http://www.mattkruse.com/javascript/calendarpopup/

I tried it out. It works perfectly if I simply do it in a traditional
HTML page or a plain independent ASPX page. But, it does not work if
the ASPX page has a master page.

The error message is the kind of notorious Javacript error which says
that the thing referred to "is null or not an object".

It is hard to NOT to have a master page these days, right? So,
besides NOT using master pages, is there a solution to this problem?

Looks like the the javascript calendar script is not loaded if we use
master page, since it is complaining about null or non-object-hood.

Thank you.

Oh, I think it is necessary to add in case you wonder why I don't put
the javascript link or code in the master page.

I tried it. It still refuses to work.
 
G

gnewsgroup

What did Matt Kruse say when you emailed him...?

A few tests seem to tell me that if I try to use the popup calendar
inside <form runat="server"> </form>, then it is not gonna work.

I cannot simply put the javascript calendar control outside the <form>
tag because I would like to put it in a GridView.

Sounds like it is a dead end.
 
B

bruce barker

i took a look at the code, and saw no reason it will not work with a
form or master page. one of the parameters is the textbox to update, but
your code was probably passing a null. try:

var ctl = document.getElementById('<%=myTextbox.ClientID%>');


-- bruce (sqlwork.com)
 
G

gnewsgroup

i took a look at the code, and saw no reason it will not work with a
form or master page. one of the parameters is the textbox to update, but
your code was probably passing a null. try:

var ctl = document.getElementById('<%=myTextbox.ClientID%>');

-- bruce (sqlwork.com)

Hi, bruce,

Thank you. I thought that it's been a dead thread, and did not check
back until today. I have never seriously programmed in javascript,
and thus do not quite know how to use getElementById. I will give it
a try and see what happens.
 
G

gnewsgroup

i took a look at the code, and saw no reason it will not work with a
form or master page. one of the parameters is the textbox to update, but
your code was probably passing a null. try:

var ctl = document.getElementById('<%=myTextbox.ClientID%>');

-- bruce (sqlwork.com)

OK, I did give it one more try. And I think you are right. It works
OK in a simple web form, and master pages do not matter.

But, I have had no luck making any popup calendar work nicely in a
gridview. The RJS.PopupCalendar control works great in a gridview in
FireFox, but not in IE7. Until I find a workaround, I cannot use it.

The basic principle seems to be this: Popup calendar from inside a
GridView which is dynamically bound to the database is tricky, if not
impossible.

Anyone has experience playing with Popup calendars in a GridView?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top