I have a button on aspx page
<asp:Button runat="server" CssClass="sc-ButtonHeightWidth" ID="btnFirstSave" Text="Save" OnClick="btnSave_Click" />
I am trying to get the event target and event source in code behind to do some validation based on it. I tried with below code.
string ctrlname = page.Request.Params.Get("__EVENTTARGET");
string ctrlname = Request.Form["__EVENTTARGET"];
string ctrlname = Request.Params["__EVENTTARGET"];
But all the above are giving me empty values. How to get the control which caused postback everytime. Am i doing anyting wrong above?
FYI : I already tried the solution mentioned in this LINK. But its only returning button text for me. I want the buttonID.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…