在动态地向Gridview行添加属性时出现问题 [英] Issue while Adding Attribute to Gridview rows dyanamically

查看:94
本文介绍了在动态地向Gridview行添加属性时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我试图在运行时在rowdatabound中为我的gridview添加属性为





e.Row.Attributes.Add(onclick,alert(''Test''))





我想删除它的前两列。



我试过了



e.Row.Cells(0).Attributes.Remove(onclick)



但它无效。

帮助请!!

Hi all,

I am trying to add attributes to my gridview at runtime in rowdatabound as


e.Row.Attributes.Add("onclick", "alert(''Test'')")


I want to remove it for the first two columns.

I have tried

e.Row.Cells(0).Attributes.Remove("onclick")

But its not working.
Help Please!!

推荐答案

我正在使用



e.Row.cells [icount] .Attributes。添加(onclick,alert(''Test''))



代替



e.Row.Attributes.Add(onclick,alert(''Test''))





I t工作正常,因为我排除前3个计数(我不需要这些属性。)



我正在寻找更好的解决方案。



谢谢
i am using

e.Row.cells[icount].Attributes.Add("onclick", "alert(''Test'')")

in place of

e.Row.Attributes.Add("onclick", "alert(''Test'')")


I t works fine as i am excluding the first 3 counts (where i dont need these attributes.)

Still a better solution i am seeking.

Thanks


这篇关于在动态地向Gridview行添加属性时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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