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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:22:52+00:00 2026-05-15T12:22:52+00:00

In MVC .NET application we can easily use PartialView to print the output of

  • 0

In MVC .NET application we can easily use PartialView to print the output of an ASCX file.

For example, I have Book.ascx file, I could have this in the controller

public ActionResult Book(int id)
{
  BookModel model = new BookModel() { bookId = id };
  return PartialView("Book", model);
}

which returns the output of Book.ascx

Is there any way we can do this in a normal .NET website?

I want to be able to use it with AJAX, eg.
When an Update button is clicked, replace the content of <div id="book123"> with the output of /Book.ascx?id=123

Is that possible?

I am looking for something like this

$.get('Book.ascx?id=123', function(data) {
  $("#book123").html(data);
});

But that won’t work because you can’t call Book.ascx directly…

Thanks in advance

  • 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-15T12:22:53+00:00Added an answer on May 15, 2026 at 12:22 pm

    well, it is doable, but not pretty 🙂

    you could instantiate your control, and instead of passing the key via QueryString, do it via exposed property:

    var ctrl = new BookModel();
    ctrl.BookID = "book123";
    

    than you could render the HTML out of it with something like

    private string renderControl(Control ctrl)
    {
      System.Text.StringBuilder sb = new System.Text.StringBuilder();
      System.IO.StringWriter tw = new System.IO.StringWriter(sb);
      System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
      ctrl.RenderControl(hw);
      return sb.ToString();
    }
    

    than you would pass that html back via your service and insert into the div etc..

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

Sidebar

Related Questions

I have an .Net MVC application which runs fine if I use the build
I have an ASP.NET MVC web application. The application can be managed with a
How can I get a ASP.NET (inc MVC) application talking to a Flex UI
I'm currently working on a blog application in ASP.NET MVC. I can't quite figure
I've been trying to use WF in my ASP.NET application (actually, it's ASP.NET MVC
I have an ASP.NET MVC-application which I want deployable on both IIS6 and IIS7
I have an asp.net mvc application with a route similar to: routes.MapRoute(Blog, {controller}/{action}/{year}/{month}/{day}/{friendlyName}, new
I have an ASP.NET MVC application, when a user clicks on the submit button
I have an asp.net mvc application and i am trying to assign value to
In my ASP.NET MVC application, I have a project that contains all the business

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.