如何在 DataList 中单击按钮时检索 datalist 中的值
我们有一个数据列表,其中有一些数据,每个项目都有一个按钮控件。我想要实现的是,单击按钮时,将获取与单击按钮控件的 Datalist 特定行相关的数据。如何做到这一点?问题是如何将按钮控件附加到该特定行中相关的值?请注意,我使用 ArrayList 作为数据源,因为我通过 pageDataSource 类启用填充...
We have a Datalist in which we have some data, with every Item we have a button control. What I want to achieve is that on the button click, the data related to that particular row of Datalist is fetched whose Button control is clicked. How to accomplish this? The problem is how to attach the button control with values related in that particular row? Note that I am using ArrayList as the Datasource since I am enabling padding via pageDataSource class...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为
Button
实现OnDataBinding
事件。然后在Button
中将CommandArgument
设置为可标识您单击的行的内容。然后为DataList
实现OnItemCommand
事件。您将能够读取所单击的Button
的CommandArgument
,然后执行您需要的任何操作。Implement the
OnDataBinding
event for theButton
. Then in theButton
set theCommandArgument
to something that will identify the row you are clicking. Then implement theOnItemCommand
event for theDataList
. You will be able to read theCommandArgument
for theButton
that was clicked and then perform whatever action you need.