Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8877181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:24:03+00:00 2026-06-14T19:24:03+00:00

I’m trying to achieve a manual postback to trigger code not attached to a

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:24:04+00:00Added an answer on June 14, 2026 at 7:24 pm

    I eventually figured out what was happening…

    The dynamically created linkbutton was performing a postback as part of its server click (onClick) event (although I had not bound any event to it). On my dev machine, the OnClientClick events postback was beating the OnClick postback, so all the expected code was running as normal.

    For some reason, once deployed to the server, the servers OnClick event was beating the OnClientClick event, so the full postback was occuring without the additional __EVENTARGUMENT information that the OnClientClick event was providing.

    To get around this, i found another post on this site that explained how to cancel the default postback, but still execute client side javascript.

    My server side code is now updated as follows:

        LinkButton newButton = new LinkButton() {
            OnClientClick = "StockINSubmit()",
            Text = "Submit",
            ID = "lnkStockInSubmit"
        };
        newButton.Attributes.Add("onClick", "return false;");
        PlaceholderStockInSubmit.Controls.Add(newButton);
    

    Which is now working like a charm 🙂

    Thanks for your help guys.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.