禁用GridView控件使用jquery里面的一个按钮 [英] Disabling a button inside a gridview using jquery

查看:164
本文介绍了禁用GridView控件使用jquery里面的一个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个GridView和6列有一个链接按钮。我想根据第七列的值来启用/禁用链接按钮....荫使用以下code。但它不会工作...

I have a gridview and on the 6th column there is a link button. I want to enable/disable the link button according to the value of 7th column.... Iam using the following code. but it wont work...

$('#<%=xgvVisitersRegister .ClientID%> tr').each(function() {
        if ($(this).find('td:eq(7)').text() != "") {
            $(this).find('td:eq(6)').attr("disabled", true);
            }
            else {
               $(this).find('td:eq(6)').attr("disabled", false);
            }
        });

请帮助我纠正它..
在此先感谢...

Pls Help me to correct it.. thanks in advance...

推荐答案

尝试禁用的TD里面的链接按钮,而不是禁用TD。

Try disabling the link button inside the td instead of disabling the td.

$(this).find('td:eq(6) a').attr("disabled", true);

查找TD内的锚标记。

Find the anchor tag inside the td.

但更好的方法将在服务器端本身进行检查。

But the better method will be check this in the server side itself.

您可以勾 <强>的RowDataBound 事件里面,你可以检查这个。

You can hook the RowDataBound event and inside that you can check for this.

这篇关于禁用GridView控件使用jquery里面的一个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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