如何清除Request.Param.Get("__ EVENTTARGET") [英] How do i clear the Request.Param.Get("__EVENTTARGET")

查看:109
本文介绍了如何清除Request.Param.Get("__ EVENTTARGET")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web表单,上面有2个控件.

I have a webform on which i have 2 controls.

1.超链接

2.图片按钮

Hyperlink的导航URL如下" javascript:__ doPostBack('Hello','')"

The Navigate URL for Hyperlink is as follows "javascript:__doPostBack('Hello','')"

并且图像按钮具有关联的onClick事件.

And the image button has an onClick event associated.

在我的页面加载中,我执行以下操作

In my Page load i do the following

if(Page.IsPostBack)

if(Page.IsPostBack)

{

string functionCall = Request.Params.Get("__ EVENTTARGET");

string functionCall = Request.Params.Get("__EVENTTARGET");

 

if(functionCall =="Hello")

if(functionCall == "Hello")


{

CallingHello();

CallingHello();

}

}

 

上面的示例说,当单击超链接时,我调用CallingHello()方法,当单击图像"按钮时,将调用关联的onclick事件.

The above sample says that when a hyperlink is clicked i call CallingHello() method and when Image button is clicked the onclick event associated is called.

现在,当我第一次调用超链接时,调用转到CallingHello()方法.执行此操作后,如果我单击图像"按钮,则不会清除"__EVENTTARGET"对话框.参数,并且仍然转到CallingHello() 方法.

Now when i first call the hyperlink the call goes to CallingHello() method. After this action if i click Image button it doesnt clear the "__EVENTTARGET" param and still goes to CallingHello()  method.

我如何清除"__EVENTTARGET"参数.在第一次通话后.

how do i clear the "__EVENTTARGET" param. after the first call.

尝试过-Request.Param.Set("__ EVENTTARGET",")-不支持的异常(只读收藏集)

Tried -- Request.Param.Set("__EVENTTARGET", "") -- Not Supported Exception  (Read only collection)

Request.Param.Remove("__ EVENTTARGET")-不支持的异常(只读收藏集)

Request.Param.Remove("__EVENTTARGET") -- Not Supported Exception  (Read only collection)

预先感谢

Rajesh

推荐答案

如果您使用 __ EVENTARGUMENT并切换那个吗?看这里: http://aspalliance.com/895_Understanding_the_JavaScript___doPostBack_Function.5

What if you use the __EVENTARGUMENT and switch off that? See here: http://aspalliance.com/895_Understanding_the_JavaScript___doPostBack_Function.5

-路易


这篇关于如何清除Request.Param.Get("__ EVENTTARGET")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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