如何使用c#asp.net清除数据服务器端文本框? [英] How to clear data server side textbox using c# asp.net?

查看:81
本文介绍了如何使用c#asp.net清除数据服务器端文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我希望在使用c#asp.net提交数据后清除服务器端的asp .net文本框,

但是我的文本框数据,它只清除客户端,但服务器端不清除,当我回发我的页面时,值仍然在服务器端并添加我当前的值。



我没有为这个TextBox定义任何Session和View State。



所以,请帮助我。

我们怎样才能清除来自服务器端文本框的数据?



在此先感谢。



Ankit Agarwal

网站开发人员

Hello,

I want to clear server side asp .net textbox after data submit using c# asp.net,
but my textbox data,It's clearing only client end but server side end it's not clearing, when I postback my page so, value is also still in server end and add in my current value.

I did not define any Session and View State for this TextBox.

So, please help me.
How can we clear data from server side textbox?

Thanks in Advance.

Ankit Agarwal
Website Developer

推荐答案

protected void Page_Load(object sender, EventArgs e)
   {
       if(IsPostBack)
       {
           TextBox1.Text = "";
       }
   }



试试这个。


Try this.


在提交按钮中单击,执行提交操作后添加



In your submit button click , after doing the submit operations add

TextBox1.Text=String.Empty;


这篇关于如何使用c#asp.net清除数据服务器端文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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