开发者

how to retrieve a value in datalist on the button click in DataList

开发者 https://www.devze.com 2022-12-20 18:51 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号