I'm trying to achieve a manual postback to trigger code not attached to a control. I don't want to use AJAX PageMethods as I need to reference certain controls during the postback, and want the result to update to a gridview on the page.
I already have two other methods that work, but for some reason my third one doesn't once deployed, but does work fine on my dev machine.
Code behind (Page_load)
switch (Request["__EVENTARGUMENT"]) {
case "ItemReserved":
GetAllStock();
break;
case "PendingItemRemoved":
PopulatePending();
break;
case "StockInSubmitted":
SubmitNewStock(); // this doesn't fire
break;
}
I inserted a line to write to a log file as soon as the code reached "SubmitNewStock()". The log was written to on my dev machine, but not on the webserver. Both other postbacks work as expected.
Page scripts
function ctxMenu_Reserve() {
PageMethods.SetItemReserved(CGRefForMenu);
__doPostBack('', 'ItemReserved');
HideMouseMenu();
}
function ctxMenuPending_Remove() {
PageMethods.RemovePendingItem(CGRefForPendingMenu);
__doPostBack('', 'PendingItemRemoved');
}
function StockINSubmit(){
SubmitPlaceHolder = document.getElementById('<%=PlaceholderStockInSubmit.ClientID %>');
SubmitPlaceHolder.innerHTML = "Processing...";
__doPostBack('', 'StockInSubmitted'); //Causes postback, but relevant code is not triggered once on my live server
}
Does anyone know why this is not working once I deploy the site to my live webserver?
I should mention that StockINSubmit() is initiated from a dynamically created client link button which is placed inside a modal popup box.
PlaceholderStockInSubmit.Controls.Add(
new LinkButton() {
OnClientClick = "StockINSubmit()",
Text = "Submit",
ID = "lnkStockInSubmit"
});
StockINSubmit() replaces the HTML content of the DIV containing that button. (So I click "Submit", and it changes to a "Processing" label). I cant see a reason why that would cause any issues, but thought it was worth mentioning.