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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:39:34+00:00 2026-06-08T23:39:34+00:00

We have a web control that we want to render into a div on

  • 0

We have a web control that we want to render into a div on the already loaded page. This needs to happen when the user clicks on a hyperlink in the menu.

The web control has some javascript files that are added to it dynamically in the C# code.

We also arent using aspx files, and want to load the web control onto a normal html page.

Please let me know what would be the best way to do this, or direct me to an article as I’m struggling to find anything useful on the web. any help is appreciated.

  • 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-08T23:39:35+00:00Added an answer on June 8, 2026 at 11:39 pm

    You can render your control dynamically in a string, send the string back and place it inside your div. Using ajax you call the code behind to render the control and return you the results.

        // load the control
        var oCConrol = Page.LoadControl("CustomControl.ascx");
    
        // here you need to run some initialization of your control
        //  because the page_load is not loading now.
    
        // a string writer to write on it
        using(TextWriter stringWriter = new StringWriter())
        {
          // a html writer
          using(HtmlTextWriter renderOnMe = new HtmlTextWriter(stringWriter))
          {
            // now render the control inside the htm writer
            oCConrol.RenderControl(renderOnMe);
    
            // here is your control rendered output.
            strBuild = stringWriter.ToString();
          }
        }
    

    Alternative you can get the same results by just make an extra empty aspx page with only your control inside and call it using Ajax. The result will be again the control

    The javascript how ever is dificult and can not go with the control. You can not send text back and then make it run as javascript inside the control, this must be done separated.

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

Sidebar

Related Questions

I have a Web User Control that contains a CheckBoxList. MyListControl: <asp:checkboxlist id=chkList runat=server>
I have a web page that I display in a WPF WebBrowser control within
I have a web page that uses three controls to allow a user to
I have a web user control that generates the following html on the client.
my problem is this: i want to create a server control that inherits System.Web.UI.WebControls.Button
I have a web user control where I have ten asp buttons. I want
I have a dynamically created TextBox in a C#/ASP.NET web page that I want
This seemed easier in Web Forms; I'd have a user control, with the logic
I have a simple Web Browser Control that displays a local webpage and that
I have a web role configured with SSL, which has a ReportViewer control that

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.