[英]Button List inside the DataList control
I am a facing a situation in which I need to use something like a ButtonList
inside a DataList
control. 我面临着一种情况,我需要在DataList
控件中使用诸如ButtonList
类的东西。
Since there is no control like ButtonList
, should I nest a DataList/Repeater
inside the DataList
or there is some other better option to handle the situation. 由于没有像没有控制ButtonList
,我应该巢DataList/Repeater
内部DataList
或有其他更好的选择处理的情况。
I am not exactly sure what you are looking for but this is what I assume you want: 我不确定您要寻找的是什么,但这是我假设您要的:
YourListItem1
ButtonAction1
ButtonAction2
ButtonAction3
ButtonAction4
YourListItem2
ButtonAction1
ButtonAction3
YourListItem3
ButtonAction1
ButtonAction2
YourListItem3
ButtonAction3
ButtonAction4
Or something similar? 还是类似的东西?
To produce this you could just have a DataList
with a Repeater
inside that contains the buttons you need. 为了制造这个你可能只是有一个DataList
与Repeater
内包含您所需要的按键。 You could implement the OnDataBinding
event of your DataList
(YourListItem)
and then bind the data that produces the buttons based on some data. 您可以实现DataList
(YourListItem)
的OnDataBinding
事件,然后绑定基于某些数据生成按钮的数据。 Then in the Repeater
you could implement each button's OnDataBinding
event and assign the CommandArguments
with the ID or detail you need to make the button act specific to the row it is on. 然后,在Repeater
您可以实现每个按钮的OnDataBinding
事件,并为CommandArguments
分配所需的ID或详细信息,以使按钮针对其所在的行进行特定操作。
This method would allow you to make one function for each button used in your template and the CommandArgument
would define the details of the action. 使用此方法,您可以为模板中使用的每个按钮创建一个功能,而CommandArgument
可以定义操作的详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.