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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:32:44+00:00 2026-05-31T21:32:44+00:00

I am generating dynamically textboxes and adding them to a placeholder as below. TextBox

  • 0

I am generating dynamically textboxes and adding them to a placeholder as below.

 TextBox txt = new TextBox();

 txt.ID = "txt" + ds.Tables[0].Rows[i]["id"].ToString();
 txt.Width = 250;
 txt.ToolTip = ds.Tables[0].Rows[i]["TotalMarks"].ToString();
 phMemberTextboxes.Controls.Add(txt);
 phMemberTextboxes.Controls.Add(new LiteralControl("\n<br />"));

i want to access the values from these textboxes. and need to check if the textbox value is less than tooltip value. If so need to reset textboxes.
How can i do so?

  • 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-31T21:32:45+00:00Added an answer on May 31, 2026 at 9:32 pm

    When u add dynamically generated controls to placeholder, their IDs get changed, you have to set control’s ClientID first to access it at client side:

    txt.ClientID = "txt" + ds.Tables[0].Rows[i]["id"].ToString();
    txt.Attributes.Add("onblur", string.Format("validateControl('{0}');", txt.ClientID);
    

    Then in your javascript:

    function validateControl(ctrlId){
        var txtCtrl = document.getElementById(ctrlId);
        int txtVal = txtCtrl.value;
        // Note that getAttribute doesn't work in IE 6 and requires exact property name
        var txtMarks = parseInt(txtCtrl.getAttribute("title")); 
        if (txtVal.length < txtMarks.length){
            // Reset textbox value and show the message
            txtCtrl.value = "";
            var msg = "Value must be greater than " + txtMarks;
            alert(msg);
            txtCtrl.focus();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that is currently generating dynamically created textboxes in a table
I'm dynamically generating radio buttons in my code behind and assigning javascript to them
I am dynamically generating new classes (using Javassist) and I would like to be
I am dynamically generating rows of a table from the ajax response I am
I am dynamically generating an image as shown below. How can I pass parameters
In my sharepoint web-part application. I am dynamically generating LinkButtons as below. and this
I am dynamically generating textboxes in ASP page and suppose they are calling javascript
For my webpage, I have a number of lists which I'm generating dynamically from
i'm dynamically generating asp controls inside an update panel on a certain trigger. However,
i'm generating controls dynamically on my asp.net page by xslt transformation from an xml

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.