Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text on Textmode Time property in .NET 4.5 disappears in Code Behind

I read many topics about this but I'm having a problem with the Textmode = "Time" property on .NET 4.5, as well.

I have this on aspx side:

<asp:TextBox runat="server" ID="txtBoxStartTime" TextMode="Time"></asp:TextBox>

On vb.net side, when I try to get the Text value from this textbox, I have nothing but empty string ("").

CDate(txtBoxStartTime.Text)

On client-side, in webInspector I can easily take the value from the textbox, but I need it in server-side...

Even though I try with HTML5 tags with runat="server" I encounter the same problem.

I've noticed the problem is the same with all of the Textmode Property on Framework 4.5

Any suggestions/solutions on this? I truly appreciate your input!

Thanks!

like image 658
Emi Avatar asked Aug 13 '14 19:08

Emi


1 Answers

Use this Attribute: "format"

<asp:TextBox ID="txtTime" runat="server" TextMode="Time" format="HH:mm" />

it will return the format of 24 for hours.

if your value is 10:00 PM then in server side the (txtTime.Text) value will be "22:00".

I Test it in Chrome and it's work

like image 168
Abdu Imam Avatar answered Oct 23 '22 00:10

Abdu Imam