Google Brother Up


Readonly Textbox - Error Solve - sans Javascript

How to Solve: -
1) Error in getting the value of a read only textbox in
2) Create a readonly textbox without using Javascript.

1) When u add a text box as: -

{asp:TextBox ID="txtDate" runat="server" ValidationGroup="Submit" ReadOnly="true" Text="" TabIndex="2" /}

2) and try to get the value of the textbox in code behind as: -

objPressReleaseBO.Date = Convert.ToDateTime(txtDate.Text);


Error Occurs: String was not recognized as a valid DateTime.


the value Text of the text box cannot be read by the control


1) take an html textbox {input runat="server" type="text" name="txtDate" id="txtDate" value="txtDate" tabindex="2" readonly /}

2) capture the value of the textbox from code behind as

objPressReleaseBO.Date = Convert.ToDateTime(txtDate.Value);

Solved: - 

1) Then the text box becomes read only
2) Also the value of the textbox is possible to capture from code behind.

179 unique visitors

No comments:

Drop Down List