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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:04:28+00:00 2026-05-27T23:04:28+00:00

I am trying to read cells value from asp.net GridView control in Client Site

  • 0

I am trying to read cells value from asp.net GridView control in Client Site JavaScript.
Below is my GridView HTML View.

<asp:GridView 
ID="GridView1" 
runat="server" 
AutoGenerateColumns="False" 
Width="596px" 
DataKeyNames="Key" >

<Columns>
    <asp:BoundField DataField="Key" HeaderText="Key" SortExpression="key" Visible="False" />
    <asp:BoundField DataField="StockId" HeaderText="StockId" Visible="False" />
    <asp:BoundField DataField="Freq1" HeaderText="Freq1" Visible="False" />
    <asp:BoundField DataField="Freq2" HeaderText="Freq2" Visible="False" />     

    <asp:BoundField DataField="MedicineName" HeaderText="MedicineName" ReadOnly="true" />

    <asp:TemplateField HeaderText="DoseQty" >                                                        
        <ItemTemplate>
            <asp:TextBox ID="txtDoseQty" Text='<%# Bind("DoseQty") %>' runat="server"
            Height="23px" Width="38px" onchange="javascript:dataChange(event);" ></asp:TextBox>
        </ItemTemplate>
    </asp:TemplateField>

    <asp:BoundField DataField="DoseUOM" HeaderText="DoseUOM" ReadOnly="true" />

    <asp:TemplateField HeaderText="Duration">
        <EditItemTemplate>
            <asp:TextBox ID="Duration" runat="server" Height="16px" 
                Text='<%# Bind("Duration") %>' Width="45px" onkeypress="return isNumberKey(event);"></asp:TextBox>
        </EditItemTemplate>
        <ItemTemplate>
            <asp:Label ID="lblDuration" Text='<%# Bind("Duration") %>'  runat="server"></asp:Label>
        </ItemTemplate>
    </asp:TemplateField>

    <asp:TemplateField HeaderText="Delete All">
        <HeaderTemplate>
            <asp:CheckBox ID="chkHeaderDelete" runat="server" Text="Delete All" 
                onclick="javascript:SelectheaderCheckboxes(this)" />                                                            
        </HeaderTemplate>
        <ItemTemplate>
            <asp:CheckBox ID="chkItemDelete" runat="server" AutoPostBack="true"
                Text="Delete" onclick="javascript:SelectitemCheckboxes(this)"  />
        </ItemTemplate>
    </asp:TemplateField>

    <asp:CommandField HeaderText="Update" 
        ShowEditButton="True"                                                         
        CausesValidation="false"  />

</Columns>

I am using javascript function to read this grid view.

var grid = document.getElementById("<%= GridView1.ClientID %>");
var OutputString = "";
if (grid.rows.length > 0) {
for (i = 1; i < grid.rows.length - 1; i++) {
    for (j = 0; j < grid.rows[i].cells.length; j++) {
        OutputString += "grid.rows[i].cells[" + j + "]  :" + grid.rows[i].cells[j] +
            "\ngrid.rows[i].cells[" + j + "].innerText :" + grid.rows[i].cells[j].innerText;
        OutputString += "\n\n";             
    }
}
}

Here is my output.

---------------------------
Message from webpage
---------------------------
grid.rows[i].cells[0]  :[object]
grid.rows[i].cells[0].innerText :Abd pant XXXL

grid.rows[i].cells[1]  :[object]
grid.rows[i].cells[1].innerText : 

grid.rows[i].cells[2]  :[object]
grid.rows[i].cells[2].innerText :Pieces

grid.rows[i].cells[3]  :[object]
grid.rows[i].cells[3].innerText :1 

grid.rows[i].cells[4]  :[object]
grid.rows[i].cells[4].innerText :Delete 

grid.rows[i].cells[5]  :[object]
grid.rows[i].cells[5].innerText :Edit

---------------------------
OK   
---------------------------

My problem is I don’t know how to get the value from grid.rows[i].cells[1] which is included ASP.net TextBox Control as TemplateColumn.

Every suggestion will be really appreciated.

  • 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-27T23:04:29+00:00Added an answer on May 27, 2026 at 11:04 pm
     function getgridvalue()
         {
          // Call this on button click
         Array obj;
          var gridview=document.getElementById("<GridView ID here>"); //Grab a reference to the Grid
          for (i=1;i<gridview.rows.length;i++) //Iterate through the rows
           {
            obj[i]=gridview.rows[i].cells[1].firstChild.value; //get the values
           }
    
         }
    

    here is an approximate approach.Hope it helps.

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

Sidebar

Related Questions

I am trying to get my program to read a value from a particular
I am trying to read a single file from a java.util.zip.ZipInputStream , and copy
I am trying to read ASCII text response from a tcp open streaming socket
I'm trying to implement database value edition through a DataGridView control but honestly I'm
I am trying to find out how to read the value of my WPF
I have been trying to strip out some data from HTML files. I have
I am trying to get cells from excel into csharp but not sure what's
I am trying to read a number from an excelsheet using PHPExcel. The code
I am trying to read data from a file, tokenize it and sort it,
I'm trying to make use of a dictionary plist as shown below: I read

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.