Showing posts with label dates. Show all posts
Showing posts with label dates. Show all posts

Saturday, March 24, 2012

Calender Question

Hey, All my calender inputs are done with the ajax calender control, only problem is all the dates are coming up "American-style" ie MMMM d YYYY, is there a bit of code that`ll format this correctly? i just want the date to look like (if its today for instants) 16/07/07

Thanks in advance si!

You can set the format property to "dd/MM/yy" 
<ajaxToolkit:Calendar runat="server" TargetControlID="Date1"CssClass="ClassName"Format="dd/MM/yy"PopupButtonID="Image1" />

When i went to update the test date i got the error :

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

Is there a way of formatting the data in the database ? Si!


Here is a link that will help you to format in SQL

http://www.sql-server-helper.com/tips/date-formats.aspx

CalendarExtender: How to count days between two selected dates

Hi

How can I calculate the days between selected dates from 2 calendarExtender controls?

thank you

zipfeli

Are you calculating client side or server side?


Clientside. Actually I want to validate the days between two textboxt dates before postback. More than 30 days should give errormessage .


Hi,

Here is a sample for your reference:

function fun(e)
{
var ce1 = $find("ce1");
var start = ce1.get_selectedDate();
if(start == null)
return;
var ce2 = $find("ce2");
var end = ce2.get_selectedDate();
if(end == null)
return;

start.setDate(start.getDate() + 30);
if(start < end)
alert("invalid");
start.setDate(start.getDate() - 30);
}

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></div>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" BehaviorID="ce1" runat="server" TargetControlID="TextBox1"OnClientDateSelectionChanged="fun">
</ajaxToolkit:CalendarExtender>

<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender2" BehaviorID="ce2" runat="server" TargetControlID="TextBox2" OnClientDateSelectionChanged="fun">
</ajaxToolkit:CalendarExtender>

Hope this helps. 
 

CalendarExtender: Any way to make dates unselectable?

I'd like to make certain dates unselectable (ie Public Holidays)

Anyone know of a way to do it with the new calendar, something along the lines of the DayRender event that we have for the bog standard ASP calendar would be perfec.

thanks.


hi, i have the same problem. i also want to make dates in furure unselectable. this is possible with old asp:Calender, but not with CalenderExtender of AjaxToolkit. if you have found a solution please inform me.

many many thanx. my email:paijyj@.gmail.com


My approach has been to allow them to select it but then use a validator to inform them they can't choose a date in the future/past whenever.

Wednesday, March 21, 2012

CalendarExtender returns date in wrong format

Hi, i'm using the CalendarExtender control within my web forms. However it keeps returning my dates in the format mm/dd/yyyy but i need it in the format dd/mm/yyyy. I was wondering if someone could tell me how this could be done. ThanksUse the Format property of the CalendarExtender.