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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:24:59+00:00 2026-05-22T02:24:59+00:00

in code behind : b.Append(<table style=’background-color:#f3f3f3; border: #336699 3px solid; ); b.Append(width:80%; font-size:10pt; font-family:Verdana;’

  • 0

in code behind :

  b.Append("<table style='background-color:#f3f3f3; border: #336699 3px solid; ");
            b.Append("width:80%; font-size:10pt; font-family:Verdana;' cellspacing='0' cellpadding='3'>");
            b.Append("<tr><td colspan='9' align ='center'  style='background-color:#336699; color:white;'>");
            b.Append("<b>Machine Counter</b>");
            b.Append("</td></tr>");
            b.Append("<td><b>MACHINENAME</b></td>");
            b.Append("<td><b>START</b></td>");
            b.Append("<td><b>END</b></td>");
            b.Append("<td><b>TOTAL_RUNTIME</b></td></tr>");

            for (int i = 0; i < newds.Tables[0].Rows.Count; i++)
            {

                b.Append("<tr>");
                b.Append("<td>" + newds.Tables[0].Rows[i]["machinename"].ToString() + "</td>");
                if (newds.Tables[0].Rows[i][3].ToString() != "Y")
                {
                    b.Append("<td><input type = 'textbox' READONLY = 'readOnly'   id = 'TextBoxRow_" + i + "col_" + 1 + " '   value = '" + newds.Tables[0].Rows[i]["end_counter"].ToString() + "'   /></td>");
                }
                else
                {
                    b.Append("<td><input type = 'textbox' READONLY = 'readOnly'    id = 'TextBoxRow_" + i + "col_" + 1 + " '   value = '" + 0 + "'   /></td>");                 
                }

                b.Append("<td><input type = 'textbox'   id = 'TextBoxRow_" + i + "col_" + 2 + " '   value = '" + 0 + "'  onkeypress  = 'return checkNum(this.id)'   onchange = 'return change_text( ("+i+")'  /></td>"); //   onchange = ' return change_text(" + i + " )'


                if (newds.Tables[0].Rows[i][3].ToString() != "Y")
                {
                    b.Append("<td ><input type = 'textbox' READONLY = 'readOnly'   id = 'TextBoxRow_" + i + "col_" + 3 + " '   value = '" + newds.Tables[0].Rows[i]["end_counter"].ToString() + "'   /></td>");
                }
                else
                {
                    b.Append("<td ><input type = 'textbox' READONLY = 'readOnly'  id = 'TextBoxRow_" + i + "col_" + 3 + " '   value = '" + 0 + "'   /></td>");
                }
                b.Append("</tr>");
            }
            b.Append("</table>");

java script function in aspx page :

 function change_text(i)
  {
      var txtvalue1 = document.getElementById("TextBoxRow_"+i+"col_1");    
      var txtvalue2 = document.getElementById("TextBoxRow_"+i+"col_2");   
      var txtvalue3 = document.getElementById("TextBoxRow_"+i+"col_3").value;          
   }

problm:

in function onchange = ‘return change_text(this.id )’

i could able to pass the value of textboxrow_icol_2 ,

i need to pass the values of other 2 boxes in the same function textboxrow_icol_1 &
textboxrow_icol_3

how to do it.. please help me out to solve this isue

  • 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-22T02:24:59+00:00Added an answer on May 22, 2026 at 2:24 am

    If I understand you correctly, you only need the onchange on one of your textboxes, but within its handler you want to be able to access the values from three textboxes in the same row?

    In your server side code do this:

    b.Append("<td><input type = 'textbox' id = 'TextBoxRow_" + i + "col_" + 2 + " ' value = '" + 0 + "' onkeypress = 'return checkNum(this.id)'  onchange = 'return change_text(" + i + ")'  /></td>"); 
    

    So that you just pass the row number to your change_text() function. Then in your client-side code do this:

    function change_text(i) {
       var txtvalue1 = document.getElementById("TextBoxRow_" + i + "Col1").value;
       var txtvalue2 = document.getElementById("TextBoxRow_" + i + "Col2").value;
       var txtvalue3 = document.getElementById("TextBoxRow_" + i + "Col3").value;
    
       // use values as appropriate, parse as floats, whatever
    }
    

    Alternatively you can do onchange='return change_text(this);', passing the function a reference to the input directly instead of its id or row number, and then define your function something like:

    function change_text(myInput) {
       var parentTD = myInput.parent;
       var parentTR = parentTD.parent; // or myInput.parent.parent;
       var txtvalue1 = parentTR.cells[1].firstChild.value;
       var txtvalue2 = myInput.value;
       var txtvalue3 = parentTR.cells[3].firstChild.value;
       // Note: the above is just one way to work your way through the DOM
       // to get to the elements you care about, and I did that off the top
       // of my head without testing it so I may have got it wrong.
       // You should Google getElementsByTagName(), childNodes, firstChild, etc.
       // to learn about how to access DOM structure through your code.
    }
    

    EDIT: If you copy and paste my first example it won’t work because I got the capitalisation wrong and left out an underscore for your input id attributes. So where I had "Col1" it should be "col_1" (and so forth for col_2, col_3).

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

Sidebar

Related Questions

I'm building a html table dynamically in an ASP.NET code behind file using C#.
Code Behind: [WebMethod] public static string emp() { return BlaBla; } Aspx Page: $(document).ready(function()
The code behind file creates a list of employees and the asp.net page loops
In code-behind of an ASP.NET page I have this method: public string TestFunc() {
In code-behind I can do this to select something: // Select item in first
In my code behind I wire up my events like so: protected override void
ASP.Net: In code-behind I can simulate <%# Eval(Property)%> with a call to DataBinder.Eval(myObject,Property); How
I am currently publishing code behind .aspx in SharePoint. I can automatically publish the
I'm using my code-behind page to create a save button programmatically: Button btnSave =
I know about code-behind files, but what is the best real-world way of Designers

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.