如何在gridview内的表中获取ASP控件的ID [英] how to get the ID of the ASP control inside a table inside gridview

查看:65
本文介绍了如何在gridview内的表中获取ASP控件的ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..

我有一个棘手的问题要问..

我想在表格中获取ASP控件的ID,表格在里面gridview ...

这里的代码可以让你有更好的想法...

Hi everyone..
I have a tircky question to ask..
I want to get the ID of the ASP control inside a table and the table is inside a gridview...
Here's the code to give you a better idea...

<asp:GridView ID="gvTest" runat="server">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <table width="100%">
                            <tr>
                                <td><asp:Label ID="lblTestLabel" runat="server"></asp:Label></td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>



我在gridview中获取控件没有问题,这是代码


I have no problem getting the control inside a gridview and here's the code

function TestFunction(sender, e)
{
     var gridview = document.getElementById('gvTest.ClientID');
     var i = gridview.rows.length - 1;
     var node1 = gridview.rows[i].cells[1].children[0];
 }



但我需要将表格放在gridview格式问题中,当我这样做时,控件无法访问....

所以我的问题是如何在javascript中获取ASP标签的ID(在这种情况下,lblTestLabel)?

非常感谢答案和建议..


But i need to put table inside gridview for formatting issues and when i did it, the controls are not accessible ....
So my question is how can i get the ID of the ASP label (in this case, lblTestLabel") in javascript??
Answers and suggestions are very much appreciated..

推荐答案

大家好..现在问题解决了:

Hi guys.. Problem solved now using :
var value =


('[id


= lblTestLabel]')。val();
=lblTestLabel]').val();


这篇关于如何在gridview内的表中获取ASP控件的ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆