如何将DataBinder.Eval(Container.DataItem," ID")分配给超链接控件的id属性 [英] How to assign DataBinder.Eval(Container.DataItem, "ID") to id attribute of hyperlink control

查看:48
本文介绍了如何将DataBinder.Eval(Container.DataItem," ID")分配给超链接控件的id属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...

我有一个超链接控件。我想用DataBinder.Eval(Container.DataItem,ID)设置id属性。



我该怎么做?



如何从后面的代码中访问这个id?

Hi...
I have a hyperlink control.I want to set id attribute with DataBinder.Eval(Container.DataItem, "ID").

How can I do this?

How to access this id from code behind?

推荐答案

try

ID='<%# DataBinder.Eval(Container.DataItem, "ID")%>'


假设这是转发器控件中超链接的ID(因为否则你可以设置固定ID)使用ItemDataBound事件来设置ID,而不是试图通过EVAL绑定它。



其他类型的列表也是如此,只是事件可能不同。
Assuming this is ID of the hyperlink within repeater control (since otherwise you could set fixed ID) use ItemDataBound event to set the ID instead of trying to bind it via EVAL.

Same goes for other types of list, just the event may be different.


这篇关于如何将DataBinder.Eval(Container.DataItem,&quot; ID&quot;)分配给超链接控件的id属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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