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

The Archive Base Latest Questions

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

Could someone please advise what the correct method is for adding HTML content to

  • 0

Could someone please advise what the “correct” method is for adding HTML content to an ASP.NET page dynamically?

I am aware of the following declarative method.

//Declaration
<%= MyMethodCall() %>


//And in the code behind.
protected String MyMethodCall()
{
    return "Test Value";
}

Is there a better or best practice way?

EDIT: I am building a Galleriffic photo gallery dynamically depending on the images located in a specific folder.

  • 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-21T03:15:53+00:00Added an answer on May 21, 2026 at 3:15 am

    Depends what you want to do.

    For controls/text I normally use a LiteralControl and set the Text property as the HTML I want to add, then this control can be added anywhere on the page that you want it to appear

    LiteralControl reference is
    here

    ok seeing as you want it for Galleriffic, I guess it would pseudo-appear as such…

     LiteralControl imageGallery = new LiteralControl();
        string divStart = @"<div id='thumbs'><ul class='thumbs noscript'>";
        imageGallery.Text += divStart;
        foreach ([image in images])
        {
          string imageHTML = @"<li><a class='thumb' name='optionalCustomIdentifier' ref='path/to/slide' title='your image title'>
                               <img src='path/to/thumbnail' alt='your image title again for graceful degradation' /></a>
                               <div class='caption'><div></li>";
    
          imageGallery.Text += imageHTML;
        }
        string divEnd = @"</ul></div>";
        imageGallery.Text += divEnd;
    
        this.[divOnPage].Controls.Add(imageGallery);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone please advice why i have a memory leak in this code? I
Could someone please provide explanation how Java multi-threaded program (e.g. Tomcat servlet container) is
I need some help I have written the following preg_replace. The idea of the
So, this is a bit of a personal problem, but maybe people will have
I am trying to access iPhone's photo album photo images through ALAssetsLibrary and upload(send)
From a standpoint of using XHTML 1.0 Strict as DOCTYPE -- would the input
I have a leak in my application and I've come to reduce my code
I would like to fetch a random object from a fetch request that I
I've written a simple algrithm to do aiming in 3D space. It should return

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.