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 3692188
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:14:01+00:00 2026-05-19T04:14:01+00:00

Basically, I have an asp.net ajax enabled usercontrol, and now I’d like to just

  • 0

Basically, I have an asp.net ajax enabled usercontrol, and now I’d like to just return a simple string value, to be used in some js I’m firing after the ajax request is done.

I’ve been fiddling around with the endrequest method, which I already set up to use for exception handling, which works fine. But is there no way to simply return a string value?

First I thought I could do this through Response.Write(); but args.get_response() doesn’t like when you do that apparantly – can anyone point me in the right direction?

Thanks!

  • 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-19T04:14:01+00:00Added an answer on May 19, 2026 at 4:14 am

    You can use the ScriptManager.RegisterDataItem method with the Sys.WebForms.PageRequestManager. Consider the following test page which when you click the button it registers data item with the script manager and at the client side it handles the endrequest and get that data item,

    <%@ Page Language="C#" AutoEventWireup="true" Inherits="WebApplication1._Default" %>
    
    <script runat="server">
        protected void btTest_Click(object sender, EventArgs e)
        {
            ScriptManager1.RegisterDataItem(btTest, "Your value to pass to the client");
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:UpdatePanel ID="upTest" runat="server">
                <ContentTemplate>
                    <asp:Button ID="btTest" runat="server" Text="Click Me" OnClick="btTest_Click" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        </form>
    </body>
    <script language="javascript" type="text/javascript">
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
    
        function endRequestHandler(sender, args) {
            var dataItems = args.get_dataItems()['<%= btTest.ClientID %>'];
            if (dataItems != null)
                alert(dataItems);
        }
    </script>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is what I'm talking about: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ComboBox/ComboBox.aspx basically I want to have a drop
I have an ASP.NET application. Basically the delivery process is this one : Nant
I have basically two separate sites, a SharePoint collaboration site, and an ASP.Net application
I have a WCF service in an ASP.NET AJAX app that is returning json.
I have an asp.net user control on which I want to use jquery ajax.
I have an ASP.NET button. When the button is clicked, I'd like a modal
I have created an ASP.NET Webforms web application which basically inetracts with the code
I would like to do the following. Basically have a stored procedure call another
I have some experience in ASP.Net and can work my way around it without
Here's the specs: ASP.NET 3.5 using ASP.NET AJAX AJAX Control Toolkit jQuery 1.3.2 web

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.