473,396 Members | 2,139 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,396 software developers and data experts.

can not select todays date with asp calendar within an update panel

69
Hi guys,

I have an asp calendar control, text box, calendar icon, eraser icon all within an update panel. The calendar works fine, postbacks are handled without the flickering of the screen etc. my only problem is that i can not select today's date to display in the text box because by default, today's date is the selected date.

Expand|Select|Wrap|Line Numbers
  1. <asp:UpdatePanel ID="UpdatePanel_start" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
  2.                                     <ContentTemplate>
  3.                                 <asp:TextBox ID="startDateTB" runat="server" Enabled="False" style="font-family: Arial"></asp:TextBox>
  4.                                 <asp:ImageButton ID="startDateIB" runat="server" ImageUrl="~/Images/cal.gif" OnClick="startDateIB_Click" />&nbsp;
  5.                                 <asp:ImageButton ID="startErase" runat="server" ImageUrl="~/Images/erase.jpg" OnClick="startErase_Click" CausesValidation="False" />
  6.                                 <asp:Label ID="Label1" runat="server" ForeColor="Red" Text="*"></asp:Label><br />
  7.                                 <asp:Calendar ID="startCalendar" runat="server" BackColor="White" BorderColor="#999999"
  8.                                     CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
  9.                                     ForeColor="Black" Height="180px" OnSelectionChanged="startCalendar_SelectionChanged" 
  10.                                     Visible="False" Width="200px" style="position: relative" >
  11.                                     <SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
  12.                                     <TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
  13.                                     <SelectorStyle BackColor="#CCCCCC" />
  14.                                     <WeekendDayStyle BackColor="#FFFFCC" />
  15.                                     <OtherMonthDayStyle ForeColor="Gray" />
  16.                                     <NextPrevStyle VerticalAlign="Bottom" />
  17.                                     <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
  18.                                     <TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
  19.                                 </asp:Calendar>
  20.                                     </ContentTemplate>
  21.                                     <Triggers> 
  22.                                         <asp:AsyncPostBackTrigger ControlID="startDateIB" EventName="Click"/>
  23.                                         <asp:AsyncPostBackTrigger ControlID="startErase" EventName="Click" />
  24.                                     </Triggers>
  25.                                 </asp:UpdatePanel>
  26.  
My selection changed code is as follows

Expand|Select|Wrap|Line Numbers
  1.  protected void startCalendar_SelectionChanged(object sender, EventArgs e)
  2.     {
  3.         startCalendar.Visible = false;
  4.         startDateTB.Text = startCalendar.SelectedDate.ToShortDateString();
  5.       }
  6.  
my problem is that since the default date is today's date,when the user clicks on todays date in the calendar, the SelectionChanged event is never fired because the date was technically never changed so nothing happens.

Can anyone help me overcome this
Jul 3 '08 #1
1 2817
phpmel
69
sorry guys,

thanks anyway.

it is working
somehow i set the selected date to be todays date in page load.

Deleted it and it works perfectly

thanks
Jul 3 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

27
by: Dino M. Buljubasic | last post by:
I'd like to build a calendar displaying all days in a month in a grid so that when I click on the header of a square representing a day of month, I can add a new meeting etc. I know that .net...
2
by: todd.freed | last post by:
Hi All, I am using the <asp: Calendar> object. In the OnDayRender event handler I am putting text into certain day boxes, and leaving others blank. The effect is that some months have no...
7
by: Richiep | last post by:
I am trying to get a UK format date of dd/mm/yyyy. Why does the following subroutine not return a valid date in a web form? The date returned is #12:00:00 AM# but the date I entered into the...
2
by: DanWeaver | last post by:
I have a page where layout of buttons and listboxes etc is important - I would like to make use of Ajax Update panel to asynchronously update various part of the page- in Vis studio whenever I use...
2
by: Drum2001 | last post by:
Hello, I am having isues with the following: I have two forms, a MAIN FORM with a SUB FORM: Within the MAIN FORM, I have an unbound textbox (Date Format) and a command button. Onload, the...
2
by: trint | last post by:
In my winform, I have 3 dropdown style comboboxes. I want the program to always start with the "Todays date" to be selected in the three comboboxes. example of todays date selected by using all...
7
helpwithcode
by: helpwithcode | last post by:
Hi people, I am just learning java.I have been creating a project which involves JDBC Connectivity.I find that the statements, String string_dob=text_dob.getText(); //Converting string to...
3
by: anacrisan | last post by:
I've created a custom calendar control and now I would like to add some AJAX behaviour to it. Basically I want to simulate the behaviour of a calendar in an Update Panel, meaning not refreshing the...
0
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I have a calendar extender that when I put it in an update panel, the formatting that I have in CSS, does not work. If I pull it out of my update panel, it looks fine. Is there something I can do...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.