当我点击按钮时,我的代码有什么问题我无法从服务器端部分读取文本框值 我的代码如下:
<form id="form1" runat="server" class="c-form">
<asp:Label ID="zr_message" runat="server" Text=""></asp:Label>
<div>
<asp:TextBox style="margin:0px;float:left;" ID="zr_tb_hotel_name" runat="server" placeholder="Hotel Prand Name"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server"
ControlToValidate="zr_tb_hotel_name"
ErrorMessage="Hotel Brand Name Field is empty</br>"
style="margin:0px;clear:both;display:block;color:Red;"/>
</div>
<div>
<asp:TextBox style="margin:0px;float:left;" ID="zr_tb_hotel_location" runat="server" placeholder="Hotel Location"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server"
ControlToValidate="zr_tb_hotel_location"
ErrorMessage="Hotel Location Field is empty</br>"
style="margin:0px;clear:both;display:block;color:Red;"/>
</div>
<div>
<asp:Button ID="Button1" runat="server" Text="Button" onclientclick="GetServerDate();return false;" />
<button id="back" type="reset">Cancel</button>
</div>
</form>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
x_ref = Request.QueryString("ref")
If (String.Equals(x_ref, "hotel")) Then
Response.Cache.SetCacheability(HttpCacheability.NoCache)
GetServerDate()
End If
End Sub
Private Sub GetServerDate()`enter code here`
Response.Clear()
Response.Write(DateTime.Now.ToString() + "Data =" + zr_tb_hotel_location.Text)
Response.End()
End Sub
enter code here