2014-11-05 47 views
0
<asp:TextBox ID="txtBalochistanExpireDate" runat="server" MaxLength="50" TextMode="Date" CssClass="form-control" ></asp:TextBox> 

////CodeBehind 
txtBalochistanExpireDate.Text = vehiclerootpermit.BalochistanExpireDate.ToString(); 

文本框被示出作为"mm/dd/yyyy"在TextField text,应该在其是vehiclerootpermit.BalochistanExpireDate值文本字段显示"21/10/2014"无法在Asp.net输入一个日期到文本框

一般资料:

BalocistanExpireDate数据类型是SQL Server DateTime

+0

明确指定你的问题? – 2014-11-05 09:27:23

+0

'' – chridam 2014-11-05 09:31:06

+0

它没有显示任何只是”mm/dd/yyyy“写在文本框中,虽然我有使用调试车辆检查.BalochistanExpireDate。确实包含值并传递给文本框,但文本框不显示它。 – 2014-11-05 09:33:31

回答

1

通过去除试试吧.ToString()

您的代码必须像

txtBalochistanExpireDate.Text = vehiclerootpermit.BalochistanExpireDate.Date 

请分享结果作为我的情况(我曾尝试你的代码)你的代码是登顶的问题以及

+0

错误:无法隐式转换类型“System.DateTime?” '串' – 2014-11-05 09:56:40

+0

怎么回事?在我的情况下,没有这样的错误。反正你可以试试这个。 'Convert.ToString(vehiclerootpermit.BalochistanExpireDate)' – Ammar 2014-11-05 10:03:58

+0

也可以通过从文本框标签中删除'TextMode =“Date”'属性来尝试上述发布的解决方案。 – Ammar 2014-11-05 10:10:54

相关问题