I'm writing ASP.NET application, and I should check on server-side value of Request["__EVENTTARGET"]
in Page_Load
. I need to set it value from client-side programmically.
I try to set it by this:
document.getElementById('__EVENTTARGET').value = "my_value";
but it doesn't work. Can you help me, why? Thank you!
UPD:
function ShowUploadDialog(obj) {
document.getElementById('<%= uplReportLogo.ClientID %>').click();
document.getElementById('<%= hdnInvokeFileUpload.ClientID %>').value = $('input[type=file]').val();
__doPostBack(obj.id, 'Click');
}
Server controls:
<asp:FileUpload runat="server" ID="uplReportLogo" CssClass="file upload" />
<asp:Button runat="server" ID="btnReportImage" Text="Load Image..." CssClass="button action load"
OnClientClick="javascript: return ShowUploadDialog(event, this);" OnClick="btnReportImage_Click" />
UPD2:
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
I have "Access denied" exception on row theForm.submit();
Why?