ASP文本框和放大器; HTML输入 - 值总是空 [英] asp Textbox & HTML Input - Values always empty

查看:82
本文介绍了ASP文本框和放大器; HTML输入 - 值总是空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用户名的ASP文本框和密码的HTML的输入,这些都是服务器控件和包含在母版页(在一个模式弹出)。

I have an asp Textbox for a username and a HTML input for a password, these are both server controls and are contained in the master page (in a modal popup).

<input runat="server" Class="login-input" id="txtPassword" placeholder="Password" type="password"
<asp:Textbox style="float:left; margin-right:25px;" runat="server" id="txtUsername" Class="login-input" Placeholder="Username" name="txtUserName"/>

我也有迷上了在code后面的处理程序登录按钮。然而2个输入框的值始终是空的。

I also have a login button hooked up to a handler in the code behind. However the value of the 2 input boxes is always empty.

我必须包括UseSubmitBehavior我的按钮=假,因为这是唯一的方法我能得到我的点击事件

I had to include UseSubmitBehavior="False" on my button as this was the only way i could get my click event to

<asp:Button UseSubmitBehavior="False" runat="server" Class="login-button" ID="btnLogin" Text="Login" />

不知道是怎么回事,我已经检查了我的code和肯定只有1表单标签,这是我听到的可能会导致此。

Not sure what's going on here, i have checked my code and definitely only have 1 form tag, which i heard can cause this.

推荐答案

原来,在运行时我语气不包含​​在标签内。

It turned out that at runtime my modal was not contained within the tags.

所以我不得不使用

$('#divname').parent().appendTo($("form:first"));

我的脚本元素回迁表单标签内内。
(有2外模态元素),我发现了这一点,通过F12开发工具/萤火虫。

within my script to move the elements back within the form tags. (There were 2 modal elements outside) I found this out by using f12 dev tools/firebug.

这篇关于ASP文本框和放大器; HTML输入 - 值总是空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆