How to make a change in ajaxcalendar extender dateformat [Resolved]

Posted by Oswaldlily under ASP.NET on 3/14/2012 | Points: 10 | Views : 6858 | Status : [Member] | Replies : 2
Ajax calendar extender date format is 3/31/2012

I need like 2012/03/31

How to make a change




Responses

Posted by: Sksamantaray on: 3/14/2012 [Member] Silver | Points: 50

Up
0
Down

Resolved
Hi Oswaldily,
since you need the format like 2012/03/31 , you can follow this.

//.aspx
   <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<ajaxToolkit:CalendarExtender ID="CalendarExtender1" TargetControlID="TextBox1"
Format="yyyy/ MM/ dd" runat="server">
</ajaxToolkit:CalendarExtender>


//web.config

<pages validateRequest="false">
<controls>

<add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/>

</controls>
</pages>


Thanks,
Sanjay

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 3/14/2012 [Member] Bronze | Points: 25

Up
0
Down
try this:

    

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Drawing" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if(!this.IsPostBack)
{
CalendarExtendar1.TargetControlID = "TextBox1";
CalendarExtendar1.CssClass = "CalendarStyle";
Label1.ForeColor = Color.SeaGreen;
Label1.Font.Bold = true;
Label1.Font.Underline = true;
TextBox1.ForeColor = Color.Crimson;
Label1.Font.Name = "Courier New";
TextBox1.Font.Bold = true;
TextBox1.Width = 150;
TextBox1.Font.Name = "Comic Sans MS";
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Ajax CalendarExtender date format - how to set change</title>
<style type="text/css">
.CalendarStyle
{
background-color:Crimson;
color:White;
border:solid 2px DarkRed;
}
.ajax__calendar_header
{
background-color:OrangeRed;
color:Snow;
}
.ajax__calendar_footer
{
background-color:Salmon;
color:Snow;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:RosyBrown; font-style:italic;">Ajax CalendarExtender Example: How To Set Date Format</h2>
<hr width="550" align="left" color="BurlyWood" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:CalendarExtender
ID="CalendarExtendar1"
runat="server"
Format="MMMM d, yyyy"
>
</cc1:CalendarExtender>
<br />
<asp:Label
ID="Label1"
runat="server"
Text="Calendar with date format"
>
</asp:Label>
<asp:TextBox
ID="TextBox1"
runat="server"
>
</asp:TextBox>
</div>
</form>
</body>
</html>




Mark this as answer, if it helps you...................

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response