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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:23:25+00:00 2026-05-28T00:23:25+00:00

I need to load usercontrol using jquery. I created a handler class and loaded

  • 0

I need to load usercontrol using jquery. I created a handler class and loaded usercontrol through that. The jquery part is:

$.ajax({
    type: "POST",
    url: "HandlerAdminManageDataSideMenu.ashx",
    contentType: "application/html; charset=utf-8",
    dataType: "html",
    success: function (data) {
        alert("success" + data);
        $(".admin_side_menu").append(data);
    },
    error: function (XMLHttpRequest, textStatus, errorThrown) {
        debugger;
        alert("Error Occured!");
    }
});

My handler file looks like :

Public Class HandlerAdminManageDataSideMenu
    Implements System.Web.IHttpHandler, IRequiresSessionState

    Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

        'context.Response.ContentType = "text/plain"
        'context.Response.Write("Hello World!")

        context.Response.ContentType = "text/html"
        context.Response.Write(RenderPartialToString("Shared\AdminManageDataSideMenu.ascx"))
    End Sub

    Private Function RenderPartialToString(ByVal controlName As String) As String
        Dim page As New Page()
        Dim control As Control = page.LoadControl(controlName)
        page.Controls.Add(control)

        Dim writer As New StringWriter()
        HttpContext.Current.Server.Execute(page, writer, False)

        Return writer.ToString()
    End Function

    ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property
End Class

The line HttpContext.Current.Server.Execute(page, writer, False) throws error:

Error executing child request for handler ‘System.Web.UI.Page’

Can anyone help me on this?

  • 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-28T00:23:26+00:00Added an answer on May 28, 2026 at 12:23 am

    Made slight changes to RenderPartialToString function:

        Private Function RenderPartialToString(ByVal controlName As String) As String
    
        Dim page As New Page()
        Dim usercontrol As UserControl = CType(page.LoadControl(controlName), UserControl)
    
        usercontrol.EnableViewState = False
        Dim form As HtmlForm = New HtmlForm()
        form.Controls.Add(usercontrol)
        page.Controls.Add(form)
    
        Dim textWriter As StringWriter = New StringWriter()
        HttpContext.Current.Server.Execute(page, textWriter, False)
        Return textWriter.ToString()
    
    End Function
    

    Reference link : http://www.aspxtutorial.com/post/2011/01/02/Load-aspnet-web-user-control-using-jQuery-and-web-method.aspx

    Thanks for all responses.

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

Sidebar

Related Questions

I am using jQuery tab control: http://jqueryui.com/demos/tabs/#ajax My design is: <div class=container2> <!-- review
I am using JQuery within a custom AJAX user control (part of a home
I need to load an XML source using Simple XML, duplicate an existing node
Two Delphi programs need to load foo.dll, which contains some code that injects a
i'm creating an Asp.Net application and i need to load an UserControl via https
I am using a Listview in a usercontrol that I databind to a list
Im trying to find a best practice to load usercontrols using Ajax. My first
i'm using AJAX to make a user control which contains a panel that contains
I have a handler (.ashx) file that I'm using to deal with Requests. Depending
I need to load about 60 images, each on a different page, in to

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.