Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1889
  • Last Modified:

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

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
NOVBusApps
Asked:
NOVBusApps
  • 4
  • 3
1 Solution
 
dxdinhCommented:
try this
 alert (cell.getElementsByTagName("input")[0] );
0
 
dxdinhCommented:
I mean the value ....

 alert (  cell.getElementsByTagName("input")[0].value );
0
 
NOVBusAppsAuthor Commented:
I'm getting the "Microsoft JScript runtime error: Object doesn't support this property or method" error.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
dxdinhCommented:
/// I mean this

for (var row = 0; row < masterTable.get_dataItems().length; row++)
{
 alert (  cell.getElementsByTagName("input")[0].value );
}  
0
 
NOVBusAppsAuthor Commented:
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
 
dxdinhCommented:
-- 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
 
NOVBusAppsAuthor Commented:
thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now