views:

293

answers:

1

ok i need a pop up box to select date and time... but im having some trouble...

i used first modal popup (ajax) for the popup...

that is working but not looking neat...

then i put a textbox in it with the calender extender...

the problem here is when i click on textbox calender pops up but it does not seem to work because nothing is getting selected... dont know why...

here is my code... if any one has any suggestions please.....

my code is:

 <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Button" />

<asp:Panel ID="Panel1" runat="server" CssClass="ModalWindow" style="display:none;" >  

<asp:TextBox ID="TextBox2" runat="server" Width="200px"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" PopupPosition="Right" PopupButtonID="TextBox2"
TargetControlID="TextBox2" Format="dddd, MMMM dd, yyyy">
 </cc1:CalendarExtender>  
    <asp:TextBox runat="server" ID="txtHour"></asp:TextBox>
  <cc1:NumericUpDownExtender ID="txtHour_NumericUpDownExtender" runat="server"  Enabled="True" Maximum="12" Minimum="1" TargetControlID="txtHour" Width="70"></cc1:NumericUpDownExtender>

   <asp:TextBox runat="server" ID="txtMinute"></asp:TextBox>
   <cc1:NumericUpDownExtender ID="txtMinute_NumericUpDownExtender" runat="server" Enabled="True" Maximum="60" Minimum="1"  TargetControlID="txtMinute" Width="70"></cc1:NumericUpDownExtender>

   <asp:TextBox runat="server" ID="txtDayPart"></asp:TextBox>
   <cc1:NumericUpDownExtender ID="txtDayPart_NumericUpDownExtender" runat="server" Enabled="True" RefValues="AM;PM" TargetControlID="txtDayPart" Width="70"></cc1:NumericUpDownExtender>


    <br /><br /> 
     <asp:Button ID="btnOk" runat="server" Text="Ok" /> 
    <asp:Button ID="btnClose" runat="server" Text="Close Me" /> 
   </asp:Panel> 

   <cc1:ModalPopupExtender 
    BackgroundCssClass="modalBackground" 
    DropShadow="true" 
    OkControlID="btnOk" 
    CancelControlID="btnClose" 
   runat="server" 
   PopupControlID="Panel1" 
   id="ModalPopupExtender1" 
    TargetControlID="Button1" /> 

thanks

I cannot use Jquery for this... but just that why does the calender work with modalpopup

In IE the arrows to move the months is not working and in mozilla nothing is getting selected in the calender ... please help...

+1  A: 

Hi there,

I got this running and it appears to work fine - the modal popup appears, i can select a date using the calendar and it populates the textbox.

As for the popup 'not looking neat' I'd suggest that's down to the ModalWindow class you've defined.

Can you elaborate on the error? Are you getting any JavaScript errors at all?

Are you trying to populate Label1? If so, you'll need to add a function call to the OnOkScript attribute of the ModalPopupExtender, something like this:

function populateLabel() 
{
document.getElementById("<%= Label1.ClientID %>").innerHTML = document.getElementById("<%= TextBox2.ClientID %>").value;
}
Town
I have not used javascript.... and which browser are you using..??for IE you can select the date but you cannot move to the next month.. and for mozilla... nothing seems to be working...
I've tried IE8 running as both IE8 and in IE7 compatibility mode, and FF 3.5.5. All work fine (although IE8 behaves slightly differently when switching months).The calendar popup will use JavaScript even if you have explicitly written any, hence the question about JS errors.
Town
are u sure it is working in firefox or u made any of your own changes... coz it is not working i cannot select anything when calender comes up...
i can get the values in the label so dont worry about it... but still thanks.. I am using IE 8 ... but i cannot click the right left arrow to change months
Which version of the Toolkit are you using? Earlier I was using the .net 2.0 version, now i've tried the 3.5 version from here (http://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33804) and the calendar is appearing underneath the modal popup, which isn't the problem you've described but another issue altogether! However, if i set the position to TopLeft then i get something similar to what you describe - clicking left or right simply closes the calendar. Is that the behaviour you're getting?
Town
I was using 30930, but switching to 30512 resolved the month selection issue for me. However, it didn't resolve the z-index problem with the calendar appearing underneath the popup. I haven't used the 3.5 versions of the toolkit before, but these types of issues make me glad I'm still on 2.0!
Town