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

The Archive Base Latest Questions

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

I have an asp.net listview with a column that contains, 2 input type =

  • 0

I have an asp.net listview with a column that contains, 2 input type = button (id=Start, id=Stop, 1 input type = text (id=TimeMInutes) and 1 span(id=spCountDown).
The HTML rendered from all these controls including the listview is…

 <table id="ctl00_ContentPlaceHolder1_lstViewFormulas_itemPlaceholderContainer" style="vertical-align:top; border:solid 1px gray">
        <tr id="ctl00_ContentPlaceHolder1_lstViewFormulas_Tr1" style="vertical-align:top; border:solid 1px gray">
            <td class="ListViewHeader" style="width:20%">
                 <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_lblFormName">Step Name</span></td>
            <td class="ListViewHeader" style="width:10%" align="center">
                 <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_lblTiming">Timing</span></td>
            <td class="ListViewHeader" style="width:30%">
                 <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_Label6">Area Used</span></td>
            <td class="ListViewHeader" style="width:10%">
                 <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_lblClock">Timer</span></td>
            <td class="ListViewHeader" style="width:30%">
                 <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_lblProd">Products</span></td>
        </tr>


        <tr style="">
           <td>
              <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_ctrl0_lblFormName">Step 1</span>
           </td>
           <td>
              <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_ctrl0_lblTiming">20</span>
           </td>
           <td>
              <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_ctrl0_lblAreaUsed">Scalp</span>
           </td>
           <td>

            <input type="button" onclick="countdown(document.getElementById('TimeMinutes'), document.getElementById('spCountDown'))"; value="Start" id="Start" />
            <input type="button" onclick='stopcountdown()'; value="Stop" id="Stop" />


            <input type="text" value='20' id="TimeMinutes" />
              <span id="spCountDown"></span>
           </td>

I am trying to pass the “TimeMinutes” input type = “text” and the “spCountDown” Span into a javascript function.

I have tried several ways, including…

<input type="button" onclick="countdown(document.getElementById('TimeMinutes'), document.getElementById('spCountDown'))"; value="Start" id="Start" />

I have also tried to find these controls within the javascript function using the input id, but I don’t get the right row.

I need to take the value from the input type = text and in the javascript function start a countdown.

  var interval;
  var seconds=0;
  function countdown(txtminutes, spanid) {
      interval = setInterval(function () {
          var sp = document.getElementById("spanid");
          var minutes = document.getElementById("txtminutes").value
          if (seconds == 0) {
              if (minutes == 0) {
                  sp.innerHTML = "countdown's over!";
                  clearInterval(interval);
                  return;
              } else {
                  minutes--;
                  seconds = 60;
              }
          }
          if (minutes > 0) {
              var minute_text = minutes + (minutes > 1 ? ' minutes' : ' minute');
          } else {
              var minute_text = '';
          }
          var second_text = seconds > 1 ? 'seconds' : 'second';
          sp.innerHTML = minute_text + ' ' + seconds + ' ' + second_text + ' remaining';
          seconds--;
      }, 1000);
  }

  function stopcountdown() {
      window.clearInterval(interval);
      var sp = document.getElementById("CountDown");
      sp.innerHTML = ''
  }

How can I pass in these controls so I can get and set the right value from the right row?

Thanks

  • 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-17T16:10:47+00:00Added an answer on June 17, 2026 at 4:10 pm

    You call getElementById twice!

    If you use this

    <input type="button" onclick="countdown(document.getElementById('TimeMinutes'), document.getElementById('spCountDown'))"; value="Start" id="Start" />
    

    Then change this

    var minutes = document.getElementById("txtminutes").value;
    

    to this

    var minutes = txtminutes.value;
    

    You pass a reference to the element as a parameter, then you try to create a new reference to a element with id of the reference. That wont work. Simply remove the document.getElementById part.

    Also… dont forget to cast the string to a int using parseInt()

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

Sidebar

Related Questions

I have an asp.net listview with a column that contains 2 buttons, a textbox
I have an asp.net ListView that is sortable. I have a button with a
In Asp.net I have a listview that has a column called Amount. Negative numbers
I have a ListView in ASP.NET where one column consists checkBoxes. I want the
I have an asp.net listview control with a asp:button in its itemtemplate . I
I'm working on a ASP.NET web forms application. I have a four-column listview, bound
In my asp.net page I have a listview that has a datapager defined in
I have an asp.net listview. The data that populates it is sorted into groups,
I have a asp.net Listview that is generating extra elements, good thing is the
I have an ASP.NET 2.0 ListView control (aka:parent) and configured inside this ListView I

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.