文本框可见属性 [英] textbox visible property

查看:106
本文介绍了文本框可见属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,
我的aspx页面中有一个文本框,下拉列表和按钮.
在下拉列表中选择项目后,我将使用javascript使文本框显示为false.
而且,
在Button中单击im进行一些验证,如果验证失败,则会发出警报.

我的问题是,
当我单击按钮时,警报运行良好,但文本框自动可见(true).
我从不编写代码来使文本框在aspx.cs页面中显示为true.
但它仍然在发生..
如何解决呢?
请帮助我...

Hi Friends,
I''m Having a textbox , Dropdownlist and Button in my aspx page.
When item is selected in dropdown list, I make textbox visible false by using javascript.
And,
in Button click im doing some validation and the alert will come if there is any validation failed.

My Problem is,
When I click button the alert is working fine but the textbox is visible (true) automatically.
I never write code to make textbox visible true in aspx.cs page.
But still its happening..
How to solve this?
Please help me on this...

推荐答案

hi
这里的问题是页面回发

页面上的lode方法,您只需检查
is(!page.postback)
textbox.visible = false;
hi
Here the problem is page postback

on page lode method u just check the
is(!page.postback)
textbox.visible=false;


这是因为您的页面在验证后发回了

我建议您在按钮单击事件上写可见属性,例如

Its because ur page is posting back after validation

I suggest you to write visible property on your button click event like

textbox.visible=false;



并在页面上加载



and on page load write

textbox.visible=true;


受保护的void LinkBut​​ton1_Click(对象发送者,EventArgs e)
{
如果(LinkBut​​ton1.Enabled == true)
{
TextBox1.Visible = true;
Button1.Visible = true;
}
}

受保护的void Button1_Click(对象发送者,EventArgs e)
{
如果(Button1.Enabled == true)
{
TextBox1.Visible = false;
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
if (LinkButton1.Enabled == true)
{
TextBox1.Visible = true;
Button1.Visible = true;
}
}

protected void Button1_Click(object sender, EventArgs e)
{
if (Button1.Enabled == true)
{
TextBox1.Visible = false;
}
}


这篇关于文本框可见属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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