aspx页面刷新 [英] aspx page getting refreshed
本文介绍了aspx页面刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友.
我有一个带一些文本框和组合框以及一个按钮的aspx页面.为按钮的单击事件添加了一个JavaScript函数,以进行客户端验证.问题是...按下按钮后输入一些数据后,输入的数据会丢失..好像页面正在刷新.我已将所有文本框和下拉列表的"AutoPostBack"属性设置为错误的;我是asp.net的新手.
有人可以帮助我吗?任何帮助将不胜感激.
Hello Friends.
I have an aspx page with some textboxes and combo boxes and a button.A javascript function is added for the button for its click event for clientside validation. The problem is...After entering some data when i am pressing the button, the datas i entered is getting lost..as if the page is being refreshed.I have set the "AutoPostBack" Property for all the text boxes and dropdownlists to false; I am very new to asp.net.
Can somebody help me plse.Any help will be highly appreciated.
推荐答案
看人,我听不懂,但是按按钮时这很正常,页面必须回发或我认为即使您放下组合键并检查AoutoPostBack = false,我也刷新了.
还有另一种保存数据的方法,onButtonClick可以获取数据(例如:textBox),并将其存储在viewstate或 session 中,然后您可以检查页面加载是否会话不为空,请给cobmo会话中的值
look man i dont understand correctly but it is normaly when you press a button the page must PostBack or refreshed i think even if you put the combo and check AoutoPostBack = false .
There is another way to keep the data, onButtonClick you can take the data (ex: textBox) and store is in viewstate or session then you can check in page load if the session is not empty give the cobmo the value in session
protected void Button2_Click(object sender, EventArgs e)
{
if(!string.IsNullOrEmpty(txtBox.Text))
{
session["Value"] = txtBox.Text;
...
...
}
}
and in
protected void Page_Load(object sender, EventArgs e)
{
if (session["Value"] != null)
{
txtBox.text = (string)session["Value"]
}
Session.Remove("Value");
}
Best Regards.
试试这个
将EnabledViewState="true"
放在页面指令或所有控件中
Try this one
PlaceEnabledViewState="true"
in page directive or to all the controls
这篇关于aspx页面刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文