文本框在页面加载后丢失值 [英] textbox loses value after page load

查看:48
本文介绍了文本框在页面加载后丢失值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了asp文本框

< asp:TextBox ID =   comfirmVal runat =   server class =   confirmElm> < /   asp:TextBox  >  



和javascript我把条件的价值



 $( 。delList)。click( function (){
if (确认(' 您确定要删除此列表吗?')){
document .getElementById( comfirmVal)。value = 1 ; // 1表示是删除
} 其他 {
document .getElementById( comfirmVal)。value = 2 ; // 2 for no
}
});





i想要在我的vb代码中检查文本框值

 如果 comfirmVal.Text = value.ToString 那么 
deleteList(fullPath)
结束 如果







但是comfirmVal.Text为空是在页面加载后丢失值



任何帮助?

解决方案

< blockquote>( 。delList)。click( function (){
if (确认(' 您确定要删除此列表吗?')){
document .getElementById( comfirmVal)。value = 1 ; // 1表示是删除
} 其他 {
document .getElementById( comfirmVal)。value = 2 ; // 2 for no
}
});





i想要在我的vb代码中检查文本框值

 如果 comfirmVal.Text = value.ToString 那么 
deleteList(fullPath)
结束 如果







但是comfirmVal.Text为空是在页面加载后丢失值



任何帮助?


你必须使用

  document  .getElementById(' <%= comfirmVal.ClientID%>')。value 

而不是

  document  .getElementById(  c omfirmVal)。值


i made asp text box

<asp:TextBox ID="comfirmVal" runat="server" class="confirmElm"></asp:TextBox>


and by javascript i put value for it in condition

$(".delList").click(function () {
                if (confirm('Are you sure you want to Delete This List?')) {
                    document.getElementById("comfirmVal").value = 1; //1 for yes delete
                } else {
                    document.getElementById("comfirmVal").value = 2; //2 for no
                }
            });



i want check text box value in my vb code

If comfirmVal.Text = value.ToString Then
                    deleteList(fullPath)
End If




but comfirmVal.Text is empty is loses the value after page load

any help ?

解决方案

(".delList").click(function () { if (confirm('Are you sure you want to Delete This List?')) { document.getElementById("comfirmVal").value = 1; //1 for yes delete } else { document.getElementById("comfirmVal").value = 2; //2 for no } });



i want check text box value in my vb code

If comfirmVal.Text = value.ToString Then
                    deleteList(fullPath)
End If




but comfirmVal.Text is empty is loses the value after page load

any help ?


Hi, you must use

document.getElementById('<%= comfirmVal.ClientID %>').value

rather than

document.getElementById("comfirmVal").value


这篇关于文本框在页面加载后丢失值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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