是否有一个F5浏览器之间的差异,并刷新回发??(asp.NET) [英] Is there a difference between an F5 browser refresh and postback??(asp.NET)
问题描述
我是动态创建在不同的行asp.NET现有的数据网格
I am dynamically creating dragrids in different rows of an existing datagrid in asp.NET
我的生成DataGrid中有一列是TemplateColumn中(一个复选框列)。
My generated datagrids have a column which is TemplateColumn (a CheckBox Column).
在我父母的DataGrid,我有一个复选框模板列。当我选中或取消选中的复选框的值时,check_change方法被调用(自动回设置为true),动态生成的DataGrid中失去了检查的复选框(复选框全部选中再次)。不过,如果我检查所有的孩子(动态生成的)电网和preSS F5的复选框,它刷新的页面,但我仍然有我的检查复选框。
In my parent datagrid, I have a template column with checkboxes. when I check or uncheck the value of the check box, the check_change method is called (autopostback is set to true), the dynamically generated datagrids lose the checked checkboxes (the checkboxes are all unchecked again). However, if i check any of the checkboxes of the child (dynamically generated) grids and press F5, it refreshes the page but still I have my checked checkboxes.
这是怎么回事?怎么又回来后,从刷新F5不同???理解这可能会帮助我在这里解决我的问题:<一href="http://stackoverflow.com/questions/3307878/datagrid-tree-two-levels-dynamically-generated-grids-cannot-be-altered">DataGrid没有被改变!
What's happening ?? how is post-back different from refresh F5??? understanding this might help me fix my problem here :DataGrid not being altered!
推荐答案
这很简单,浏览器缓存响应。所以,如果你preSS F5,你会一般见到的网格与检查复选框各一次。但是,如果你做了一回后,在code,你强制浏览器连接到服务器并发布数据。
It's simple, the browser caches the response. So if you press F5, you'd generally see your grid with the checked checkboxes each time. But if you do a post-back in code, you force the browser to connect to the server and post the data.
然后,它会等待来自服务器的响应,并返回了什么回来后的原因了。
It will then wait for a response from the server, and return whatever the reason for the post-back was.
讨厌,但这就是浏览器。您可以强制完全刷新比模拟一回后通过按Ctrl + F5键。
Annoying, but that's how browsers work. You can force a complete refresh than emulates a post-back by hitting Ctrl+F5.
这是(有时)依赖于浏览器,因为当你在这里描述的不是所有的浏览器都做得一样。
This is (sometimes) browser dependent because not all browsers will act the same as you described here.
如果一回后是必要的,但你仍想保留的复选框状态为选中,我推荐一个AJAX调用。
If a post-back is necessary but you still want to keep the checkbox status as checked, I'd recommend an AJAX call instead.
这篇关于是否有一个F5浏览器之间的差异,并刷新回发??(asp.NET)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!