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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:26:09+00:00 2026-06-03T04:26:09+00:00

I have an ASMX service which serves some partial-HTML to a web-app as part

  • 0

I have an ASMX service which serves some partial-HTML to a web-app as part of a JSON object. Until now, I’ve just been building the HTML in code, using StringBuilders. This is a huge pain since the formatting is really hard to read and I can’t use any of Visual Studio’s/Resharper’s code completion, syntax highlighting, and other convenient features.

I tried to solve this with User Controls (I’m not committed to this approach if there is a better way. All I need are some very simple parametrized static partial HTML pages), but now I am running into problems when I try to render the control like this:

public override string Html
    {
        get 
        {
            StringWriter writer = new StringWriter();
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);
            CreateTestWizardPartials.TestPeriods testPeriodsHtml = new CreateTestWizardPartials.TestPeriods();
            testPeriodsHtml.RenderControl(htmlWriter);
            htmlWriter.Flush();

            return writer.ToString();
        }
    }

This always returns an empty string. I’ve read you need to use Page.LoadControl() to dynamically load User Controls but there is no Page for me to use it with. Is there a workaround or a better solution than User Controls?

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-06-03T04:26:10+00:00Added an answer on June 3, 2026 at 4:26 am

    You could load static HTML file that contain the partial bits of markup you need. If you need to somehow bind the markup with dynamic data, then render the HTML files through a template engine.

    Here’s and older post regarding some template systems for ASP.Net:
    Can you recommend a .net template engine?

    And another more recent post regarding ASP.Net MVC:
    JQuery's $ is in conflict with that of StringTemplate.Net in ASP.Net MVC

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

Sidebar

Related Questions

I have web site which serves web services (a mixture of .asmx and WCF)
I have some basic questions related to the conversion of Web Service (.asmx) into
I have an existing web service (ASMX) which exposes a service FooService with a
I have a small app which query our SharePoint server' Web Service interface for
We have a lot of web services (.asmx files, which can be accessed for
I have an asmx web service that should only be allowed to respond to
I have a .NET web service (using asmx...have not upgraded to WCF yet) that
Im trying to create an ASMX Web Service in Visual Web Developer.I have successfully
I have a web service that contains 2 asmx files (public.asmx and private.asmx). On
I have a web service contains a web method with the url http://localhost/Service1.asmx?op=AddNumbers .

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.