473,545 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

69 New Member
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 SelectionChange d 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 2824
phpmel
69 New Member
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
2677
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 provides a calendar control but that one is not what I want. I want my callendar to fill whole form and display only one month. I would like to...
2
4698
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 additonal text rendered, some months will have 2 weeks(rows) with no additional content and 1 week with 2 or 3 rows of rendered text. Essentially, the size...
7
6807
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 text box was 24/06/2006. The other solution I have tried is given by the following two lines that do not compile because a value of date type...
2
2360
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 an Update panel I then lose all control of the layout of the elemts within the panel. I also dont seem to be apble to have a vs 'panel' within an...
2
3908
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 textbox defualts to Date(). The SUB FORM has a bound textbox (Date Format). I am trying to create the code for the command button to compare the
2
3068
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 three combo dropdown boxes: cboDropDownStyle1 = June | cboDropDownStyle2 = 26 | cboDropDownStyle3 = 2007 Those items already exist in the...
7
5323
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 date System.out.println(string_dob); s.Info_DOB=Date.valueOf(string_dob); runs perfectly fine in the method insert() and throws up an...
3
1689
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 whole page when the month changes. Is there a way to achieve this without actually using the Update Panel? Thanks in advance.
0
1199
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 to make the CSS formatting work for my calendar extender keep and the same format when inside an update panel that it has outside an update panel?
0
7486
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7932
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5347
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4965
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3456
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1905
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
729
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.