?
Solved

Date format

Posted on 2005-05-14
5
Medium Priority
?
196 Views
Last Modified: 2010-04-07
Hi,

I am using a DataPicker(calendar control) in my form. How can I populate the a textbox with selected date in DD MMM YYYY ?

Now I get the date in dd mm yyyy format. I have declared Culture="en-GB" in the page directive.

ayha
0
Comment
Question by:ayha1999
  • 3
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
b1xml2 earned 500 total points
ID: 14001932
TextBox1.Text = Calendar1.SelectedDate.ToString("dd MMM yyyy")
0
 
LVL 7

Author Comment

by:ayha1999
ID: 14002854
Hi b1xml2,

Where I do that in the code?

Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
        '// Clear the link from this day
        e.Cell.Controls.Clear()

        '// Add the custom link
        Dim Link As System.Web.UI.HtmlControls.HtmlGenericControl
        Link = New System.Web.UI.HtmlControls.HtmlGenericControl
        Link.TagName = "a"
        Link.InnerText = e.Day.DayNumberText
        Link.Attributes.Add("href", String.Format("JavaScript:window.opener.document.{0}.value = '{1:d}'; window.close();", Request.QueryString("field"), e.Day.Date.ToString))

        '// By default, this will highlight today's date.
        If e.Day.IsSelected Then
            Link.Attributes.Add("style", Me.Calendar1.SelectedDayStyle.ToString())
        End If

        '// Now add our custom link to the page
        e.Cell.Controls.Add(Link)

    End Sub

and here is

<a href="JavaScript:;" onclick="calendarPicker('Form1.txtDate,this);" title="Date">
Pick</a>

ayha
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 14002861
???
you have server -side code
you have client-code that cannot successfully call a server function!!

it wont work. You misunderstand how ASP.NET works.
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 14002871
either that or I dont have enough info to carry on
0
 
LVL 7

Author Comment

by:ayha1999
ID: 14002877
Hi,

As I mentioned I can get the date in the textbox in dd/MM/yyyy format. How can I make dd MMM yyyy?

sorry, I don't under understand your comment. No way to make it in dd MMM yyyy?

ayha
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question