如何使用javascript或jquery清除gridview(how to clear gridview using javascript or jquery)
我在页面上有一个网格视图和一个文件上传按钮。 我有用户将他们的数据加载到我的网站,我解析他们的文件并加载到gridview。 然后使用ajax我更新javascript / jquery我允许用户在gridview上编辑他们的数据。 我的问题是,应该很容易修复,但我很难过。 一旦用户准备好提交gridview数据,我就会向web服务发送一个AJAX调用,我会在网格上发送所有信息。 然后我想清除网格,基本上再次开始一个干净的页面。 但是我似乎无法清除网格视图。 数据只是在原始数据的控件中保持刷新。 我意识到它与服务器上绑定的事实有关,但我无法解除绑定! 我努力了。
window.location.reload()但所有这一切都让它给我一个来自firefox的蹩脚消息,告诉我该页面将会刷新。
我在这个网站上看到了不同的人
Respe.Redirect(Request.RawUrl);但是我不知道如何从Ajax调用中触发它? 我可以吗? 我正在通过Ajax做一切,部分是因为我最舒服的地方,但我不想在页面上放置另一个按钮并让用户必须单击该按钮才能重新启动它似乎很傻。 我想对我的命令进行整页刷新。 无论如何通过AJAX做到这一点? 放一个服务器按钮对我来说似乎不可行,因为一旦我在网格视图中加载数据,我使用jquery数据表和jeditable并在客户端上工作。 在这一点上,我愿意接受建议,想法,提示和任何事情。 对于应该是一项简单的任务感到沮丧。 在此先感谢Miguel
i have a grid view and a file upload button on a page. I have users load their data to my site and i parse their files and load onto the gridview. Then using ajax i update the javascript/jquery I allow users to edit their data right on the gridview. My problem is somehting that should be simple to fix but yet im stumped. Once the user is ready to submit the gridview data for good i have an AJAX call to a webservice that i send all the information on the grid. Then i would like to clear the grid and basically start with a clean page again. However i cant seem to clear the grid view. The data just keeps refreshing in the control with the original data. I realize that it has to do with the fact that is bound on the server but i cant unbinded!. i have tried.
window.location.reload()but all this does its get me a crappy message from firefox telling me that the page is going to refresh.
I saw this on this site from various people
Respe.Redirect(Request.RawUrl);however i don't know how i can trigger that from an Ajax call?. Can i? I'm doing everything through Ajax partly because is where im most comfortable, but i would hate to have to put another button on the page and make the user have to click that button to restart it seems silly. I would like to do a full page refresh on my command. Is there anyway to do this via AJAX? putting a server button does not seem feasible to me due to the fact that once i load data in grid view i use jquery data table and jeditable and work pretty much on the client. I'm open to suggestion, ideas, tips, anything at this point. So frustrated with what should be a simple task. Thanks in advance Miguel
最满意答案
要强制执行整页刷新而不回发,可以将window.location.href值设置为当前window.location.href
例如
想象一下,我们当前的范围是您的网格数据ajax提交功能的成功回调,因此当页面重新加载时将获取所有新数据。
//reload the page now that data has been updated. window.location.href = window.location.href;To force a full page refresh without postback you can set the window.location.href value to the current window.location.href
e.g.
Imagine our current scope is the success callback of your grid data ajax submission function, so when the page reloads all new data will be fetched.
//reload the page now that data has been updated. window.location.href = window.location.href;#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格
推荐阅读
留言与评论(共有 16 条评论) |
本站网友 西安海棠 | 12分钟前 发表 |
因为一旦我在网格视图中加载数据 | |
本站网友 血城 | 5分钟前 发表 |
so when the page reloads all new data will be fetched. //reload the page now that data has been updated. window.location.href = window.location.href; | |
本站网友 河北联通网上营业厅 | 18分钟前 发表 |
因此当页面重新加载时将获取所有新数据 | |
本站网友 supra价格 | 3分钟前 发表 |
我的问题是 | |
本站网友 龙腾宾馆 | 24分钟前 发表 |
因为一旦我在网格视图中加载数据 | |
本站网友 logo墙 | 7分钟前 发表 |
tips | |
本站网友 上海和平饭店 | 23分钟前 发表 |
ideas | |
本站网友 衢州房产网 | 21分钟前 发表 |
因此当页面重新加载时将获取所有新数据 | |
本站网友 广东文理职业学院 | 7分钟前 发表 |
我们当前的范围是您的网格数据ajax提交功能的成功回调 | |
本站网友 武汉二手房 | 11分钟前 发表 |
but i would hate to have to put another button on the page and make the user have to click that button to restart it seems silly. I would like to do a full page refresh on my command. Is there anyway to do this via AJAX? putting a server button does not seem feasible to me due to the fact that once i load data in grid view i use jquery data table and jeditable and work pretty much on the client. I'm open to suggestion | |
本站网友 母乳喂养会瘦吗 | 16分钟前 发表 |
基本上再次开始一个干净的页面 | |
本站网友 移风易俗的易 | 21分钟前 发表 |
ideas | |
本站网友 魅族黄章 | 16分钟前 发表 |
部分是因为我最舒服的地方 | |
本站网友 炒股指标 | 30分钟前 发表 |
我就会向web服务发送一个AJAX调用 | |
本站网友 婴儿呕吐 | 16分钟前 发表 |
我想对我的命令进行整页刷新 |