Hello Tom,
As Milosz and Mark has mentioned, the GridView is rendered as following
style html table:
===============
<table cellspacing="0" rules="all" border="1" id="GridView1"
style="width:500px;border-collapse:collapse;">
<tr>
<th scope="col"> </th><th scope="col">CategoryID</th><th
scope="col">CategoryName</th><th scope="col">Description</th>
</tr><tr>
<td style="width:25%;"><a
href="javascript:__doPostBack('GridView1','Edit$0')">Edit</a> <a
href="javascript:__doPostBack('GridView1','Delete$0')">Delete</a></td><td
style="width:25%;">1</td><td style="width:25%;">Beverages</td><td
style="width:25%;">Soft drinks, coffees, teas, beers, and ales</td>
</tr><tr>
<td style="width:25%;"><a
href="javascript:__doPostBack('GridView1','Edit$1')">Edit</a> <a
href="javascript:__doPostBack('GridView1','Delete$1')">Delete</a></td><td
style="width:25%;">2</td><td style="width:25%;">Condiments</td><td
style="width:25%;">Sweet and savory sauces, relishes, spreads, and
seasonings</td>
</tr><tr>
<td style="width:25%;"><a
href="javascript:__doPostBack('GridView1','Edit$2')">Edit</a> <a
href="javascript:__doPostBack('GridView1','Delete$2')">Delete</a></td><td
style="width:25%;">3</td><td style="width:25%;">Confections</td><td
style="width:25%;">Desserts, candies, and sweet breads</td>
........................
====================
you can use client-side script to loop through each table row and column.
e.g.
=========
function loop_table()
{
var tb = document.getElementById("GridView1");
var i,j;
var msg;
for(i=0; i<tb.rows.length;i++)
{
msg += "\r\n" + tb.rows
.cells[3].innerText;
}
alert(msg);
}
================
BTW, when would you do the cell value retrieving at client-side? Does it
occur when a user click a client-side button in each Gridview row? If so,
you can consider embed javascript in that button's client-side click script
(with the required data value get from databinding source). e.g.
==============
<asp:TemplateField >
<ItemTemplate>
<input type="button" value="button" onclick='alert(<%# "\""
+ Eval("CategoryID") + "\"" %>);' />
</ItemTemplate></asp:TemplateField>
==========
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.