谷歌映射onclick事件导致asp.net页面c#的部分回发

发布于 2024-09-28 02:06:28 字数 345 浏览 1 评论 0原文

我使用 jQuery 在 C# 中调用 AJAX webmethod。此 Web 方法运行查询并将结果信息存储在会话变量中。我有一个 gridview,它有一个 objectdatasource,它使用会话变量和 selectmethod,然后使用查询中的数据填充 gridview。我需要最后一部分才能使用新值再次将 gridview 传递到 databind() 。

所以点击地图,更新gridview。然而,也许我对这一切的看法都是错误的。本质上,采用 JavaScript 变量,在 C# 中推送到 ASP.NET,并使用查询中的新数据刷新页面上的 gridview。

我查看了各种帖子,但我在某个地方遗漏了一些东西。有人有什么想法吗?

I have used jQuery to invoke an AJAX webmethod in c#. This webmethod runs a query and stores the resulting information in a session variable. I have a gridview that has an objectdatasource that uses the session variable with the selectmethod to then populate the gridview with data from a query. I need the final piece to get the gridview to databind() again with the new value.

So click map, update gridview. However, maybe I'm going about this all wrong. In essence, take javascript variable, push to ASP.NET in C# and refresh gridview on page with new data from query.

I've looked into all kinds postings and I'm missing something somewhere. Anybody got any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

堇色安年 2024-10-05 02:06:32

也许您可以做的最简单的事情之一就是将网格包装在更新面板中。向页面添加一个 aspx 按钮,但使其可见性隐藏。根据该隐藏按钮的单击事件将异步触发器添加到更新面板。当ajax调用成功后,调用$("[id$=btnId]").click()。在该按钮后面的代码中添加一个事件处理程序以更新网格。

这不是最优雅的解决方案,但它可能是您目前所拥有的最快的解决方案。

Perhaps one of the simplest things you could do given what you've got already is to wrap the grid in an update panel. Add an aspx button to the page but make it's visibility hidden. Add an async trigger to the update panel based on the click event of that hidden button. When the ajax call succeeds, call $("[id$=btnId]").click(). Add an event handler in your code behind of that button to update your grid.

Not the most elegant solution, but it's probably the quickest win for what you've currently got.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文