Can CheckBoxList items be used in SelectParameters of ODS

  • Thread starter Thread starter Bogdan
  • Start date Start date
B

Bogdan

Hi,

I have a CheckBoxList on a page and an Object Data Source which expects
values from the list as its select parameters. Is there a way to
declaratively define select parameters to reference items in the check box
list?

Example:
<asp:CheckBoxList ID="cblTypes" runat="server" AutoPostBack="True"
RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="legend"
onselectedindexchanged="cblTypes_SelectedIndexChanged">
<asp:ListItem Selected="True" Value="1">Type1</asp:ListItem>
<asp:ListItem Value="2">Type2</asp:ListItem>
<asp:ListItem Value="1">Type3</asp:ListItem>
</asp:CheckBoxList>

[...]

<asp:ObjectDataSource ID="odsElements" runat="server"
OldValuesParameterFormatString="{0}"
SelectMethod="GetElementsByUserId" TypeName="ElementsBLL">
<SelectParameters>
<asp:SessionParameter Name="userId" SessionField="UserId" Type="String" />
[...]
</SelectParameters>
</asp:ObjectDataSource>

The BLL's select method has the following signature:
public Elements.ElementDataTable ElementsBLL.GetElementsByUserId(string
userId, short type1, short type2, short type3)

If this cannot be done declaratively then what is the best approach if the
ODS provides data to a GridView control?

Thanks,
Bogdan
 
Unfortunately the ListItem class is a sealed class.
You cannot inherit from it and add any new preoperties to it.

Again unfortunately, it also does not have any 'tag' property of type Object
on which you would hang your custom class with metadata.

You would have to whrite your own CheckBoxList component, or get a 3rd party
one.
 
Back
Top