ASP.NET - ObjectDataSource: Using a Multi-Select ListBox as a ControlParameter

I have a form containing a GridView control that binds to an ObjectDataSource control. There are several TextBox controls that are already used as ControlParameters for ObjectDataSource. I also have a custom data object that the ObjectDataSource object is associated with {TypeName = "myDataClass"}. Values ​​are passed from the ObjectDataSource to myDataClass.

Now I need to also use the Multi-Select ListBox as a ControlParameter. When I use the SelectedValue ListBox parameter, ObjectDataSource only sees the first selected item in the list.

This begs the question: how can I get all the MultiBit ListBox values ​​passed to my custom object "myDataClass", and not just the first one selected? Therefore, ["multi-select"]

Thanks for any help!

+3
source share
2 answers

Boxes with multiple choices are complex. To create a list of selected values, you need to perform a cycle of elements in the code. Thus, you probably need to implement a custom parameter that does this for you.

You may need to snap to the grid from the code, instead of doing it declaratively.

+2
source

. , . , .

0

Source: https://habr.com/ru/post/1698219/


All Articles