我正在开发 ASP.NET 应用程序。我有一个带有两组文本框的母版页:
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
<div class="loginPswd">
<asp:TextBox ID="txtPassword" TextMode="Password" runat="server"></asp:TextBox><br />
<a href="javascript:;">Forgot Password?</a>
</div>
<div class="loginBtn">
<input type="button" name="" value="Sign In" />
<a href="#signUpModal" id="signupBtn">Sign Up</a>
</div>
和
<div id="signUpModal" style="display: none;" class="modal-example-content">
<div class="modal-example-header">
<button type="button" class="close" onclick="$.fn.custombox('close');">×</button>
</div>
<center>
<div class="modal-example-body">
<p>
Start searching now<br />
<a style="color:#fff;" href="http://joelinks.com/" target="_blank">.com</a><br />
Get Started - Its free.
</p>
<div>
<label>First Name</label>
<%-- <input type="text" value="" name="" /> --%>
<asp:TextBox ID="TextFirstName" runat="server"></asp:TextBox>
</div>
<div>
<label>Last Name</label>
<asp:TextBox ID="TextLastName" runat="server"></asp:TextBox>
</div>
<div>
<label>Email</label>
<asp:TextBox ID="TextEmail" runat="server"></asp:TextBox>
</div>
<div>
<label>Password (6 or more characters)</label>
<asp:TextBox ID="TextPassword" TextMode="password" runat="server"></asp:TextBox>
</div>
<div>
<label>Retype Password</label>
<asp:TextBox ID="TextRetypePassword" TextMode="password" runat="server"></asp:TextBox>
</div>
<div>
<label>User</label>
<asp:DropDownList ID="DropDownUser" runat="server">
<asp:listitem text="Business User" Value="3" />
<asp:ListItem Text="Individual User" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
<div>
<asp:Button ID="JoinNow" runat="server" Text="Join Now" OnClick="JoinNow_Click" UseSubmitBehavior="False"></asp:Button>
</div>
<p style="font-weight:normal; margin-top:10px;">
Already on <a style="color:#fff;" href="http://.com/">JoeLinks.com</a>? <a style="color:#fff;" href="http://.com/">Sign In</a>
</p>
</div>
</center>
</div>
我在 body
标记后有一个 form
元素。我在寄存器的文本框中使用了 Submitbehavor=false
(第二个代码)。当我点击提交按钮时,它会转到代码隐藏中的该事件,但文本框的值不在代码隐藏中。如果我不使用提交行为,那么它就不会进入代码隐藏。单击登录按钮时,可以在代码隐藏中获取值。
我该如何解决这个问题?
最佳答案
由于这是提供帮助的社区,请先访问以下链接。
请告诉我们您是否清楚 UseSubmitBEehaviour 概念?
关于javascript - 使用 usesubmitbehavior=false 访问代码隐藏中文本框的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35406992/