值我有一個asp,淨文本框這樣不能得到一個只讀文本框在asp.net
<asp:TextBox readonly="true" ID="txtLastService" runat="server"></asp:TextBox>
當我試圖把它的價值得到代碼日期變量LastService背後,我得到這個錯誤
Conversion from 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
我已經使用在其他頁面相同的代碼,並能正常工作,除了此頁面 任何幫助
編輯
請注意,當我單擊窗體上的提交時,文本框的值不爲空。而且當我刪除只讀屬性時,我不會得到錯誤。但我需要這個文本框是隻讀的,因爲我正在使用javascript來選擇日期並設置它的值
我試過這個,但它沒有被禁用 – Smith 2012-04-17 06:25:31