Here is html

<asp:datagrid id="mrpDataGrid" style="Z-INDEX: 289; LEFT: 576px; POSITION: absolute; TOP: 512px" runat="server" Width="160px" Height="90px" autogeneratecolumns="False">
<AlternatingItemStyle BackColor="LightGray"></AlternatingItemStyle>
 <Columns>
  <asp:BoundColumn DataField="SCHEDULE_DT" HeaderText="Scheduled Date" DataFormatString="{0:d}"></asp:BoundColumn>
  <asp:BoundColumn DataField="SCHEDULE_QTs" HeaderText="Summed Quantity"></asp:BoundColumn>
 </Columns>
</asp:datagrid>

I need to get values of both bound columns to use in calculations.
TIA
javascript newbie

Recommended Answers

All 3 Replies

If the data are on the server computer, javascript can't see them, because javascript runs on the client computer.

the script i show puts out a aleart showing that there is 82 rows in the datagrid. i just have not been able to figure out how to get to the columns to retieve the data. i've tried navroot.rows(i). col[0], cells[0], several things and no luck.

<asp:table id="dmdTbl" style="Z-INDEX: 617; LEFT: 280px; POSITION: absolute; TOP: 552px" runat="server" Width="184px" Height="60px" >
 <asp:TableRow ID="drows" >
    <asp:TableCell ID="DmdDate" Enabled=False ></asp:TableCell>
    <asp:TableCell ID="Dqty" Enabled=False ></asp:TableCell>
 </asp:TableRow>
</asp:table>

code is this:
            var ord = 0;     // set up int
            var dd = new Date();   //set up date field
            //ord = document.getElementById('dmdTbl').rows.length;     // fid # of rows
            //alert("value "+ord);     //display number of rows
            var rowposi = document.getElementById('dmdTbl').rows;    // set position of row
            for (var i=0;i<document.getElementById('dmdTbl').rows.length;i++) {  
                 dd = rowposi[i].childNodes[0].innerText;
                 ord = rowposi[i].childNodes[1].innerText;
                 // ..... do something with dd and ord
                 //alert("value "+dd+"ord "+ord+"cnt "+i);   // show values
             }     // end for loop

I hope this help someone else.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.