Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用JavaScript/jQuery从GridView中获取单元格数据_Javascript_Jquery_Asp.net - Fatal编程技术网

使用JavaScript/jQuery从GridView中获取单元格数据

使用JavaScript/jQuery从GridView中获取单元格数据,javascript,jquery,asp.net,Javascript,Jquery,Asp.net,我有一个ASP.NET GridView服务器控件 我想要一个图像按钮服务器控件 当用户单击此图像时,jQuery/JavaScript方法应该从单击事件开始的行中的某个列中提取一个值 <tr> <td>Col1</td> <td>Col2</td> <!-- Perhaps I want this Cell value --> <td>Col3</td> </tr> 网格视

我有一个ASP.NET GridView服务器控件

我想要一个图像按钮服务器控件

当用户单击此图像时,jQuery/JavaScript方法应该从单击事件开始的行中的某个列中提取一个值

<tr>
  <td>Col1</td>
  <td>Col2</td> <!-- Perhaps I want this Cell value -->
  <td>Col3</td>
</tr>
网格视图:

     <asp:GridView>
             <Columns>   
                <asp:BoundField ... />
                <asp:BoundField ... />
                <asp:BoundField ... />
                <asp:TemplateField>
                   <ItemTemplate>
                      <asp:ImageButton ID="imgBtn"runat="server" OnClientClick="return readCellValue();"/>             
                   </ItemTemplate>
                </asp:TemplateField>
             </Columns>
</asp:GridView>


您能描述一下这个问题吗?发生了什么或没有发生什么?查看属性引号在ImageButton中的位置(在自动关闭元素末尾之外)。解决这个问题。然后请注意,
readCellValue
函数不会返回值,也不会执行任何其他可能有用的操作。
     <asp:GridView>
             <Columns>   
                <asp:BoundField ... />
                <asp:BoundField ... />
                <asp:BoundField ... />
                <asp:TemplateField>
                   <ItemTemplate>
                      <asp:ImageButton ID="imgBtn"runat="server" OnClientClick="return readCellValue();"/>             
                   </ItemTemplate>
                </asp:TemplateField>
             </Columns>
</asp:GridView>