Date format

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
LVL 7
ayha1999Asked:
Who is Participating?
 
b1xml2Connect With a Mentor Commented:
TextBox1.Text = Calendar1.SelectedDate.ToString("dd MMM yyyy")
0
 
ayha1999Author Commented:
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
 
b1xml2Commented:
???
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
 
b1xml2Commented:
either that or I dont have enough info to carry on
0
 
ayha1999Author Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.