如何清除网页 [英] How to clear a webpage

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

问题描述

我有一个在网页上写东西的功能:
例如:

I have a function to write something in my webpage:
ex:

Response.Write(str); 


但是每次页面运行时,先前的数据仍然存在.

我如何清除以前的数据.

我使用


but every time the page run the previous data is still there.

How can i clear the previous data.

I use

Response.Clear() 

但不起作用.

请帮帮我.

在此先谢谢您.

but not working.

Please help me.

Thanks in Advance.

推荐答案

从您所说的开始,听起来好像是在设置初始值,可能是在Page_Load事件中.

您应该将默认值括起来,例如:

From what you have said it sounds like you are setting the initial value, probably in the Page_Load event.

You should enclose the default values something like:

if (!IsPostBack)
{
    Label1.Text = value;
}



现在,当您单击按钮并回发时,新值将出现,因为仅在您首次进入页面时才设置初始值.



Now when you click a button and postback the new value will appear as the initial value is only set the first time you enter the page.


此提示: ^ ]应该可以帮助您清除网页的控件.
This Tip: Simple and easy way to clear all the input fields in the form.[^] should help you out in clearing the controls of the webpage.


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

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