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

  • Home
  • SEARCH
  • 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 1030929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T13:50:57+00:00 2026-05-16T13:50:57+00:00

I have a simple form (textbox, submit button) which is wrapped in an update

  • 0

I have a simple form (textbox, submit button) which is wrapped in an update panel.

<asp:UpdatePanel ID="ReplyUpdatePanel" UpdateMode="Conditional" runat="server">
    <ContentTemplate>
       <asp:Textbox id="ReplyTextBox" runat="server"/>
       <asp:Button id="SubmitButton" OnClick="SubmitButton_Click" runat="server"/>
    <ContentTemplate>
</asp:UpdatePanel>

So, when i click the button, the server-side click event is fired (SubmitButton_Click), stuff happens to the db, and the page is re-rendered (asynchronously).

Here’s my issue – i need to execute some JavaScript after all the “stuff happens to the db”.

In other words, i need to create some JavaScript whose data/parameters are based on server-side logic.

I’ve tried this:

Page.RegisterStartupScript

and this

ScriptManager.RegisterStartupScript

Neither work (nothing happens).

Now i now i can hook into the .add_pageLoaded function using the client-side AJAX libary (to execute client-side scripts once partial update is complete), but the problem is i need data from the server that is created on the button click event.

Ie:

Sys.Application.add_init(function () {
                Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function (sender, args) {
                    var panels = args.get_panelsUpdated();
                    for (var i = 0; i < panels.length; i++) {
                        // check panels[i].id and do something
                    }
                });
            });

The only “hack” i can think of at the moment is to do the above, but call a web service, getting all the data again then executing my script. I say “hack” because i shouldnt need to do an asynchronous postback, hook into the after-partial-postback event handler then call the server again just to get the info that was previously posted.

Seems like a common problem. And no, i cannot remove the UpdatePanel (even though i would love to), don’t want to waste time arguing why.

Any non-hacky ideas?

EDIT

Clarification on the data i need sent to script:

I type some text in the textbox, click submit, then the server creates a database record and returns an object, which has properties like ID, Name, URL, Blah, etc. These are the values that the script requires.

So if i were to call a web service from the client-code, in order to get the values that were just created, i would need to do some hacks (get last record modified that has the value of the textbox). Not ideal, and neither is two AJAX calls for one form post. (update panel postback, then web service call).

  • 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-05-16T13:50:58+00:00Added an answer on May 16, 2026 at 1:50 pm

    Instead of add_pageLoaded you’ll want add_endRequest here, like this:

    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function (sender, args) {
      //check here...
    });
    

    The difference is that endRequest runs when any partial postback comes back.

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

Sidebar

Related Questions

I have a simple form with just one textbox and one submit button. The
I have a simple MVC form with the following elements: <%= Html.TextBox(FechaInicio) %> Which
I have a simple form. Its got one field and a submit button. I
I have simple form like this which accepts only two values string action and
I have this simple form which shows a pop up calendar when clicked on
I have a simple form at my site which sends it data via Ajax
I have a personal simple jQuery validation script. It works when the submit button
I have a simple form which accepts a Title and a Contents variable from
I have an ASP.Net MVC Page with a very simple form on it: One
I have a simple form created using Ajax.BeginForm : <% using (Ajax.BeginForm(Update, Description, new

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.