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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:14:00+00:00 2026-05-23T02:14:00+00:00

I am having a scenario by which I have to dynamically create the form

  • 0

I am having a scenario by which I have to dynamically create the form based on the user selection. In the form, there are few textboxes which should be added at the end to the Total Textbox.

The way I am distinguishing the textboxes to be added at the end is by specifying as below..

TextBox txt1 = new TextBox();
        txt1.ID = "txt1";
        txt1.CssClass = "addToTotal";

        TextBox txt2 = new TextBox();
        txt2.ID = "txt2";
        txt2.CssClass = "addToTotal";

        TextBox txt3 = new TextBox();
        txt3.ID = "txt3";
        txt3.CssClass = "txtTotalPoints";

        PlaceHolder1.Controls.Add(txt1);
        PlaceHolder1.Controls.Add(txt2);
        PlaceHolder1.Controls.Add(txt3);

In reality, there is no css class named 'addToTotal' in the site css file. It’s just used as a flag to notify me for adding at the end.

Is it a good practice to add a .CssClass even though the actual class does not exist. Are there any pitfalls in using this methodology?

  • 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-23T02:14:01+00:00Added an answer on May 23, 2026 at 2:14 am

    I would assume that the overhead of using a CSS class which does not exist as a marker is minimal, so I wouldn’t change your implementation based on that. If you’re concerned about best practices – which you could rightly be, CSS classes were never intended to be used like this – you could add a data-* attribute to the input and use that instead:

    txt2.Attributes["data-addToTotal"] = "true";
    

    …then finding those elements with JQuery:

    $("input[data-addToTotal='true']")
    

    data-* attributes are part of HTML5, but are fully backwards compatible.

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

Sidebar

Related Questions

I am having a scenario where there are several subclasses which have got similar
I am having a scenario, in which i have multiple delegates attached to the
Scenario Having already read a post on this on the same site, which didn't
Imagine having the following scenario: You need to create a system where the Back
Having some trouble with what should be a very simple scenario. For example purposes,
I have a scenario in which i receive files from a source and i
I have an sql scenario as follows which I have been trying to improve.
Scenario: I have an application (C#) that expects a SQL database and login, which
Take this scenario: You have a few flag enumerations in C# tied to (and
We have a Seam 2 based web application with the usual user login and

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.