?
Solved

How do I grab textbox value from innerHTML of table cell?

Posted on 2010-11-10
7
Medium Priority
?
1,822 Views
Last Modified: 2012-05-10
I need to get the value of a textbox in each row that I loop through in a radgrid using javascript.  Here is the code to grab the cell which works fine.

var masterTable = $find("<%=gvLines.ClientID%>").get_masterTableView();
var cell;

for (var row = 0; row < masterTable.get_dataItems().length; row++)
{
     cell = masterTable.getCellByColumnUniqueName(masterTable.get_dataItems()[row], "Amount").innerHTML;
     alert(cell);
}  

The alert box value is:  <INPUT id="textboxid" class="textbox" value="$52.8: type="text" name="Amount">

How can I grab the value $52.8?

Thanks.
0
Comment
Question by:NOVBusApps
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 7

Expert Comment

by:dxdinh
ID: 34107941
try this
 alert (cell.getElementsByTagName("input")[0] );
0
 
LVL 7

Expert Comment

by:dxdinh
ID: 34107946
I mean the value ....

 alert (  cell.getElementsByTagName("input")[0].value );
0
 

Author Comment

by:NOVBusApps
ID: 34108626
I'm getting the "Microsoft JScript runtime error: Object doesn't support this property or method" error.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 7

Expert Comment

by:dxdinh
ID: 34109014
/// I mean this

for (var row = 0; row < masterTable.get_dataItems().length; row++)
{
 alert (  cell.getElementsByTagName("input")[0].value );
}  
0
 

Author Comment

by:NOVBusApps
ID: 34115477
Current code:

 var masterTable = $find("<%=gvLines.ClientID%>").get_masterTableView();
 var cell;
 for (var row = 0; row < masterTable.get_dataItems().length; row++) {
       cell = masterTable.getCellByColumnUniqueName(masterTable.get_dataItems()[row], "Amount").innerHTML;          
       alert(cell.getElementsByTagName("input")[0].value);    <---this line throwing same javacript error

 }
0
 
LVL 7

Accepted Solution

by:
dxdinh earned 1000 total points
ID: 34117091
-- oh sorry - can you try this

 var masterTable = $find("<%=gvLines.ClientID%>").get_masterTableView();
 var cell;
 for (var row = 0; row < masterTable.get_dataItems().length; row++) {

       // get the cell with the textbox
       cell = masterTable.getCellByColumnUniqueName(masterTable.get_dataItems()[row], "Amount");          

      // now get the value by tag name
       alert(cell.getElementsByTagName("input")[0].value);  


 }

0
 

Author Closing Comment

by:NOVBusApps
ID: 34123857
thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question