If you want to put some value inside _EVENTARGUMENT , you must do it with javascript before submitting the form with _doPostBack ('UpdatePanel1', '') , because __EVENTTARGET is a hidden field and in your html document it looks like this:
<input type="hidden" value="" id="__EVENTARGUMENT" name="__EVENTARGUMENT">
I recommend you do something like this:
function setArgAndPostBack() { var arg = document.getElementById('__EVENTARGUMENT'); var arg = document.getElementById("__EVENTARGUMENT"); arg.value = 'something you want to put to server'; __doPostBack('UpdatePanel1', ''); }
If you use jQuery this will be shorter:
function setArgAndPostBack() { $("#__EVENTARGUMENT").val('something you want to put to server'); __doPostBack('UpdatePanel1', ''); }
If this does not work, I would suggest you put one hidden field inside the Update panel:
<asp:UpdatePanel runat="server" ID="UpdatePanel1"> <ContentTemplate> <asp:HiddenField ID="hdnData" value="" runat="server" /> </ContentTemplate> </asp:UpdatePanel>
And then do the same work as above:
function setArgAndPostBack() {
In the first scenario, you can get __EVENTARGUMENT from the server side:
String args = Request["__EVENTARGUMENT"];
If the first script does not work, you can use something like this:
String args = hdnData.Value;//This works even in Page_Load function.