By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 796 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

popup calendar when using Masterpage

P: n/a
Ali
i am using visual studio 2005 and I am trying to create a popup calender so
when a user click on a image on the main form, a calender will then popup,
the user will select a date and the date will then be passed back to the main
form and populate a textbox. it works fine. but when i used master page for
all my pages and i put the textbox inside the content , the calender pops up
but when i select the date nothing happens .. the textbox was not populated
with the selected date from the calender and the window was not closed.

here's code which popups the calendar:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentColumn"
Runat="server">
<div>

<A
onclick="window.open('Calendar.aspx?textbox=txtDat e','cal','width=300,height=300,left=470,top=300')"
href="javascript:;"><asp:textbox id=txtDate runat="server"
ForeColor="Black" Width="88px"></asp:textbox>
<IMG src="images/SmallCalendar.gif" border="0"></A></div>
</asp:Content>

and here's the code for the calendar selection change:

Private Sub Calendar1_SelectionChanged(ByVal sender As 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
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
I'm not sure this has anything to do with ASP.NET 2.0. You are saying that
the window containing the ASP.NET calendar does not post back or if it does,
whatever is passed back to that window isn't used by the browser. (The
browser doesn't know about ASP.NET. It just runs HTML and scripts.)
I recommend:
1. Using the debugger to confirm that your server side code is being
executed correctly.
2. Viewing the HTML output to that window. (Right click on the window and
select View Source) Determine what the HTML is and look for errors.

There are many third party date pickers available. Some are free. Some use a
popup that doesn't require a separate window which makes it faster than the
ASP.NET calendar (no post backs) and doesn't fail when there is a popup
blocker. It may be easier to use one. In fact, ASP.NET has a rich variety of
third party controls for most situations. You can find them at www.asp.net
Control Gallery, www.123aspx.com, and www.411asp.net. Mine is "Peter's Date
Package" (http://www.peterblum.com/datecontrols/home.aspx).

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Ali" <Al*@discussions.microsoft.com> wrote in message
news:17**********************************@microsof t.com...
i am using visual studio 2005 and I am trying to create a popup calender
so
when a user click on a image on the main form, a calender will then popup,
the user will select a date and the date will then be passed back to the
main
form and populate a textbox. it works fine. but when i used master page
for
all my pages and i put the textbox inside the content , the calender pops
up
but when i select the date nothing happens .. the textbox was not
populated
with the selected date from the calender and the window was not closed.

here's code which popups the calendar:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentColumn"
Runat="server">
<div>

<A
onclick="window.open('Calendar.aspx?textbox=txtDat e','cal','width=300,height=300,left=470,top=300')"
href="javascript:;"><asp:textbox id=txtDate runat="server"
ForeColor="Black" Width="88px"></asp:textbox>
<IMG src="images/SmallCalendar.gif" border="0"></A></div>
</asp:Content>

and here's the code for the calendar selection change:

Private Sub Calendar1_SelectionChanged(ByVal sender As 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

Nov 19 '05 #2

P: n/a
Ali
Hi Peter,
Nothing wrong in my server side code ... it works properly. I tried it
without using the master page .. and it worked fine. This problem just occurs
when i use master page. so any help or suggestion will be greatly appreciated

"Peter Blum" wrote:
I'm not sure this has anything to do with ASP.NET 2.0. You are saying that
the window containing the ASP.NET calendar does not post back or if it does,
whatever is passed back to that window isn't used by the browser. (The
browser doesn't know about ASP.NET. It just runs HTML and scripts.)
I recommend:
1. Using the debugger to confirm that your server side code is being
executed correctly.
2. Viewing the HTML output to that window. (Right click on the window and
select View Source) Determine what the HTML is and look for errors.

There are many third party date pickers available. Some are free. Some use a
popup that doesn't require a separate window which makes it faster than the
ASP.NET calendar (no post backs) and doesn't fail when there is a popup
blocker. It may be easier to use one. In fact, ASP.NET has a rich variety of
third party controls for most situations. You can find them at www.asp.net
Control Gallery, www.123aspx.com, and www.411asp.net. Mine is "Peter's Date
Package" (http://www.peterblum.com/datecontrols/home.aspx).

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Ali" <Al*@discussions.microsoft.com> wrote in message
news:17**********************************@microsof t.com...
i am using visual studio 2005 and I am trying to create a popup calender
so
when a user click on a image on the main form, a calender will then popup,
the user will select a date and the date will then be passed back to the
main
form and populate a textbox. it works fine. but when i used master page
for
all my pages and i put the textbox inside the content , the calender pops
up
but when i select the date nothing happens .. the textbox was not
populated
with the selected date from the calender and the window was not closed.

here's code which popups the calendar:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentColumn"
Runat="server">
<div>

<A
onclick="window.open('Calendar.aspx?textbox=txtDat e','cal','width=300,height=300,left=470,top=300')"
href="javascript:;"><asp:textbox id=txtDate runat="server"
ForeColor="Black" Width="88px"></asp:textbox>
<IMG src="images/SmallCalendar.gif" border="0"></A></div>
</asp:Content>

and here's the code for the calendar selection change:

Private Sub Calendar1_SelectionChanged(ByVal sender As 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


Nov 19 '05 #3

P: n/a
Hello Ali,

I have notice when using master pages and other container controls that
the runtime engine seems to change the names of the controls and adds
the '$' Character to them. You might want to view the rendered HTML
source sent to the browser and see if this is the case. Unfortunately,
I am not sure if there is anything to be done about it.

Nov 19 '05 #4

P: n/a
Ali
Thanx Shawn. My hat's off for you. That was the reason of my problem. I did
the change and it worked. Thanx again

"Shawn" wrote:
Hello Ali,

I have notice when using master pages and other container controls that
the runtime engine seems to change the names of the controls and adds
the '$' Character to them. You might want to view the rendered HTML
source sent to the browser and see if this is the case. Unfortunately,
I am not sure if there is anything to be done about it.

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.