I am a facing a situation in which I need to use something like a ButtonList
inside a DataList
control.
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.
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. You could implement the OnDataBinding
event of your DataList
(YourListItem)
and then bind the data that produces the buttons based on some data. 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.
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.