2
@Narayana
The format you applied is not appropriate, format should be like this
- txtfrmDate.text=DateTime.Now.ToString("MM/dd/yyyy");
For more information about format, please visit
https://www.dotnetperls.com/datetime-format
1
I think the issue is with browser compatibility, run your application in Internet Explorer (you will get the desired result).
For more info, refer this link
http://www.c-sharpcorner.com/UploadFile/4b0136/introducing-html-5-date-input-type-in-Asp-Net/
1
Hi...
Please try once this code
if(!IsPostBack)
{
txtfrmDate.Text = DateTime.Now.Date.ToString("MM/dd/yyy");
}
1
Hi Narayana,
Try this code,
TextBox1.Text = DateTime.Now.ToShortDateString();
0
Hi Amit,
Thank for your reply.
But my application not compatibility to Internet explorer. only in chrome compatibility.
help me for this issue.
0
Hi Amit,
Debugging through break point .it's getting in text as 15-03-2017. but not dispalyed in output. i.e main problem. I can try so many times it's not working.
if plain textBox control then it dispaly but type="Date" in asp control it not dispaly .
0
@Narayana
Points to be consider in this case:
1. Put a breakpoint in the textbox and see what value is coming, is it the desired format?
2. Cross check that the value of textbox is not being changed on other part of code.
0
Hi Amit ,
It's not working. my pc date format like dd-mm-yyyy .
0
try this
txtfrmDate.Date=DateTime.Now.ToString("mm/dd/yyyy");
0
What happened? Isn't working?
0
Hi Vignesh,
Thanks for giving reply. I am asking date not for time.If i am giving plain textbox then it's ok.
but I am giving date format.
0
Hi Ramesh,
I have already try that code.It's not display.
0
https://www.daniweb.com/programming/software-development/threads/133436/set-current-time-in-textbox