如何从此方法刷新页面? [英] how to refresh page from this method?

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

问题描述

我在Home.aspx.cs中有此方法,当该方法触发时,我想刷新页面.

i have this method in my Home.aspx.cs and when this method fires, i wanna refresh my page.

public String setURL(String youtubeurl)
    {
        return url;
       
    }







how to do this??

推荐答案

Response.Redirect(Request.RawUrl)
Response.Redirect(Request.RawUrl)


方法不触发,事件这样做,所以要么发生某些事件,要么其他事件正在调用此代码.使用ASP.NET,除非用户单击某些内容(或悬停...等),否则不太可能发生与用户相关的任何事件.

您是否可以了解客户端上调用它的原因?什么是调用此方法的调用?

如果您可以在客户端测试/拦截输入,则只需使用JavaScript重新加载页面即可.

Methods don''t fire, events do, so either there''s some event that''s happening or something else is calling this code. With ASP.NET you''re not likely getting any events happening relevant to the user unless they click on something (or hover...etc.).

Can you hook into whatever it is that calls this on the client? What is invoking the call to this method?

If you can test for/intercept the input at the client side, just use JavaScript to reload the page.

window.location.reload()



干杯.



Cheers.


这篇关于如何从此方法刷新页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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