Saturday, 17 August 2013

Determining that which control caused PostBack

Determining that which control caused PostBack

I have this aspx:
<asp:ImageButton ID="check" runat="server" ImageUrl="../img/process.png"
OnClick="check_Click" CausesValidation="false" UseSubmitBehavior="false"/>
now in Page_Load I want to determine that is PostBack caused by check or
no so I followed this question's method with this code:
if(FindControl(Page.Request.Params.Get("__EVENTTARGET"))!=check)//if not
caused by "check"
//do something
but Page.Request.Params.Get("__EVENTTARGET") return null and if I use a
Button instead of ImageButton it is not null.How can I reach to my goal?

No comments:

Post a Comment