【发布时间】:2013-07-02 06:21:27
【问题描述】:
我的asp.net 表单上有一个jQuery 日期选择器。一切似乎都工作正常,除了当我提交表单时,选择的日期从文本框中丢失,.net 代码给我一个错误,因为日期丢失。
有人知道为什么会这样吗?
当我从文本框中删除 readonly=true 时它开始工作,但我需要它是只读的以防止用户错误地输入日期。
根据要求提供一些代码/脚本:
HTML:
<form id="form1" runat="server">
<asp:TextBox id="txtDate" Runat="server" readonly="true" />
<asp:Button ID="btnSendRequest" text="Send Request" Runat="server" OnClick="btnSendRequest_Click" />
</form>
jQuery:
$("#txtDate").datepicker({
dateFormat: "dd/mm/yy"
});
.NET:
Sub btnSendRequest_Click(ByVal Sender As Object, ByVal E As EventArgs)
objSQLCommand = New SqlCommand("insert query here", objConnection)
'parameters here
Try
objSQLCommand.Connection.Open()
objSQLCommand.ExecuteNonQuery()
objSQLCommand.Connection.Close()
Catch Ex As Exception
' some error here
End Try
End Sub
【问题讨论】:
-
请贴一些html代码
-
如何提交表单?贴出相关代码!
-
显然有人因为一个完全合理的问题而给我 -1 的问题带来了糟糕的一天...... ;)
标签: jquery asp.net .net-3.5 asp.net-3.5 jquery-ui-datepicker