如何从GridView中传递div控件的客户端ID [英] How to pass client id of a div control from gridview

查看:61
本文介绍了如何从GridView中传递div控件的客户端ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从gridview传递div控件的客户端ID,

我已经通过了这样的div ID

How to pass client id of a div control from gridview,

I have passed this div id like this

<label onclick="demofunction('div1')"></label>
<div id="div1">

</div>




但是在这里,它只能通过参数div1而不是客户端ID
我也试过这样




but here it going parrameter only div1 not client id
i have also trid like this

runat="server" onclick="demofunction('<%# div1.ClientID %>')"


仍然显示相同的错误


still same error is showing

推荐答案

上面定义的"div"是html元素. html控件没有名为ClientID的属性. ClientID由ASP.NET生成,用于服务器代码.使用ASP.NET的< panel>"控制,面板"控件像上面的示例一样呈现为"div".您可以从面板"控件访问ClientID.
The "div" that is defined above is an html element. The html controls donot have attribute called ClientID. The ClientID is generated by ASP.NET for server code use. Use ASP.NET''s "<panel>" contorl, "panel" control renders as "div" like above sample. You can access ClientID from "panel" control.


这篇关于如何从GridView中传递div控件的客户端ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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