We have a Da开发者_如何学运维talist 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...
Implement the OnDataBinding
event for the Button
. Then in the Button
set the CommandArgument
to something that will identify the row you are clicking. Then implement the OnItemCommand
event for the DataList
. You will be able to read the CommandArgument
for the Button
that was clicked and then perform whatever action you need.
精彩评论