Can CheckBoxList items be used in SelectParameters of ODS

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
 
L

Louis Somers

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top