I am trying to fire a form submit via jQuery and have a particular server side event fire.
Client Side Code:
$("input[name=__EVENTARGUMENT]").val("SomeArg");
form = $("body form");
form.submit();
Server Side Code:
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
if (Request["__EVENTARGUMENT"] == "SomeArg")
{
//do some stuff
}
}
}
The problem is, the "__EVENTARGUMENT" hidden input does not exist. I discovered that if I add an ASP.net server control dropdownlist with autopostback = true, the EVENTARGUMENT hidden input is created. Is there a cleaner way to have ASP.net create these hidden inputs, and allow me to get their values server side without adding controls I do not actually need on the page?