I have an asp, net textbox like this
<asp:TextBox readonly="true" ID="txtLastService" runat="server"></asp:TextBox>
when I tried to get its LastService date variable value in the code behind, I get this error
Conversion from the string 'to type' Date 'is not valid.
Exception Details: System.InvalidCastException: conversion from string "" to type "Date" is not valid. Source error: line 26: oItem.LastService = txtLastService.Text Source file:. \ Admin \ vehicle \ add.aspx.vb Line: 26
I used the same code on other pages and it works fine except for this page any help
EDIT
Please note that the value of the text field is not empty when I click the submit button on the form. And also, when I remove readonly attributes, I don't get an error. But I need this text box to be read-only, as I use javascript to select a date and set its value
source
share