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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:17:20+00:00 2026-06-10T10:17:20+00:00

My aspx page contains list of products along with dynamically generated textboxes and one

  • 0

My aspx page contains list of products along with dynamically generated textboxes and one order button with each product.

Textboxes and buttons are generated at runtime with ids like txt110234,txt110235…so on for textboxes and btn110234,btn110235…so on for buttons.

Each time user have to enter quantity in the textbox and press order button associated with any product to place any order.

Every thing is working fine but now i want to do it using ajax,so i need to get the value entered by user in text box.I want to do something like this-

   var quan = document.getElementById('<%= txt' + id + '.ClientID%>').value;

But its giving me the following error.

Compiler Error Message: CS1012: Too many characters in character literal Source Error:

How can i get the value of textbox?Any suggestion will be 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-10T10:17:21+00:00Added an answer on June 10, 2026 at 10:17 am

    The error you got is because you can’t involve javascript inside the “<%= .. %>” block. Also this doesn’t look possible since the “<%= .. %>” expression is evaluated in server before the page is rendered, but your “id” is a client side variable.

    You can set the script in server side like that:

    client side code:

    function foo(ctlID)
    {
       var quan = document.getElementById(ctlID).value;
    }
    

    server side code:

    TextBox txt = new TextBox();
    txt.ID = "SomeID";
    Form.Controls.Add(txt);
    Button btn = new Button();
    btn.ID = "someID";
    btn.OnClientClick = "foo('" + txt.ClientID + "')";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an aspx page that contains a checkbox, and a button. The button
I have an aspx page with a few textboxes and a submit button. Once
I have a page which contains the generated content. Page.aspx: <asp:DropDownList ID=cmbUsers runat=server AutoPostBack=True
I have the test1.aspx and test2.aspx. A button contains in the test1 page. I
The problem exists in my editme.aspx page. Error 1 The type 'editme' already contains
I have a child page LoginContent.aspx which contains a login form. If the user
In my .aspx page, I have download button which onclick download the .apk file.
I have an ASPX page with two RequiredFieldValidator and a button to go to
In my project I am making one form which contains three dropdown lists each
My master page contains a list as shown here. What I'd like to do

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.