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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:53:50+00:00 2026-05-20T08:53:50+00:00

I need to write an ASP.Net form which will produce the following HTML: <fieldset>

  • 0

I need to write an ASP.Net form which will produce the following HTML:

<fieldset>   
<legend>Contact Details</legend>   
<ol>   
<li>   
<label for="name">Name:</label>   
<input id="name" name="name" class="text" type="text" />   
</li>   
<li>   
<label for="email">Email address:</label>   
<input id="email" name="email" class="text" type="text" />   
</li>   
<li>   
<label for="phone">Telephone:</label>   
<input id="phone" name="phone" class="text" type="text" />   
</li>   
</ol>   
</fieldset>  

However, the fields which are to be added to the form will be determined at runtime, so I need to create the fieldset at runtime and add an ordered list and listitems to it, with labels, textboxes, checkboxes etc as appropriate.

I can’t find standard ASP.Net objects which will create these tags.

For instance, I’d like to do something like the following in C#:

FieldSet myFieldSet = new FieldSet();
myFieldSet.Legend = “Contact Details”;
OrderedList myOrderedList = new OrderedList();

ListItem listItem1 = new ListItem();
ListItem listItem2 = new ListItem();
ListItem listItem3 = new ListItem();

// code here which would add labels and textboxes to the ListItems

myOrderedList.Controls.Add(listItem1);
myOrderedList.Controls.Add(listItem2);
myOrderedList.Controls.Add(listItem3);

myFieldSet.Controls.Add(myOrderedList);

Form1.Controls.Add(myFieldSet);

Are there any standard ASP.Net objects which can produce this, or is there some other way of achieving the same result?

Matt

  • 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-20T08:53:50+00:00Added an answer on May 20, 2026 at 8:53 am

    You can try this:

    Panel myFieldSet = new Panel();
    myFieldSet.GroupingText= “Contact Details”;
    HtmlGenericControl myOrderedList = new HtmlGenericControl("ol");
    
    HtmlGenericControl listItem1 = new HtmlGenericControl ("li");
    HtmlGenericControl listItem2 = new HtmlGenericControl ("li");
    HtmlGenericControl listItem3 = new HtmlGenericControl ("li");
    
    // code here which would add labels and textboxes to the ListItems
    
    myOrderedList.Controls.Add(listItem1);
    myOrderedList.Controls.Add(listItem2);
    myOrderedList.Controls.Add(listItem3);
    
    myFieldSet.Controls.Add(myOrderedList);
    
    Form1.Controls.Add(myFieldSet);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write regex which I will use for asp.net routing constraint which
I need to write a use cases to test the asp.net mvc applicatoin. How
I need to write a web application using SQL Server 2005, asp.net, and ado.net.
Using ASP.net, how do you write ANSI characters to a text file? I need
I need to display a string which has a white space on a asp.net
I have an asp.net web form with an html input and button at the
I am trying to write a Windows Form and ASP.NET C# front-end and MSAccess
I have ASP.Net code similar to the following (this is inside a FIELDSET): <ol>
So i need to write simple Minesweeper game in asp.net (Only for learning purposes
I am trying to write an ASP.NET MVC application which is a frontend 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.