回发后如何清除文本框值 [英] How to clear text box values after postback

查看:72
本文介绍了回发后如何清除文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一个网络表单,我在其中保存个人信息时提交了姓名,年龄等个人信息.我清除了文本框的值.我也对文本框的查看状态进行了伪造.但是如果我输入了名称并保存了amit第二次,如果我再次填写信息,例如arvind之类的名称,则amit名称也将落在此处.如何在回发后清除先前的值

Hello all,
I ahve a web form where i am submitting personal information like name,age etc.when I save the information i cleared the text box values.I have also false the view state of text box.but if i have entered amit in name and save it.Second time if i fill information again something like name as arvind then the amit name is also coming down there.how to clear the previous value after postback

推荐答案



转到屏幕的设计页面,您可以找到
FORM标签.

您可以找到AutoComplete属性.然后将该值设置为"OFF".
就是这样.

如果此属性未在您的页面中显示,也可以手动编写此属性.

问候,
Kiran.
Hi,

Go to the design page of your screen,there you can find the
FORM tag.

You can find the AutoComplete property.Then set that value as "OFF".
Thats it.

If this property is not showing in your page also just write this property manually.

Regards,
Kiran.


Use AutoCompleteType property of text box.<br />
<asp:TextBox ID="TextBox1" AutoCompleteType="disabled" runat="server"></asp:TextBox>


使用此功能

Use This Function

public void EmptyControlData(Control parent)
    {
        foreach (Control c in parent.Controls)
        {
            if ((c.GetType() == typeof(TextBox)))
            {
                ((TextBox)c).Text = "";
            }
            if ((c.GetType() == typeof(DropDownList)))
            {
                ((DropDownList)c).SelectedIndex = -1;
                //((DropDownList)c).Items.Clear();
            }
            if (c.HasControls())
            {
                EmptyControlData(c);
            }
        }
    }



父母是 this .



Here parent is this.


这篇关于回发后如何清除文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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