如何使用asp.net c在文本框中显示日期# [英] how to visible date in textbox using asp.net c#

查看:104
本文介绍了如何使用asp.net c在文本框中显示日期#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,

请解释如何使用asp.net c#在文本框中显示日期?

sir,
please explain how to visible date in textbox using asp.net c#?

推荐答案

在页面加载事件处理程序中:

In your Page Load event handler:
myDateTextBox.Text = DateTime.Now.ToString();


转换数据库datetime to string and set Textbox.Text你的字符串是这样的 -

Convert your database datetime to string and set Textbox.Text your string like this -
YourTextBox.Text = DateTime.Now.ToString();


myTxt.Text = DateTime.Now.ToString();
myTxt.Text = DateTime.Now.ToShortDateString();



你还能用 DateTime.Now [ ^ ]。

只需获取日期并将其分配给TextBox即可。就这么简单:)



-KR


And what not you can do with DateTime.Now[^].
Just get the date and assign it to the TextBox. As simple as that :)

-KR


这篇关于如何使用asp.net c在文本框中显示日期#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆