Link to home
Start Free TrialLog in
Avatar of OTM
OTM

asked on

pass checkboxlist selected values through ObjectDataSource to public class function

Hi,

I'm having a bit of trouble finding a way to pass the selected values on a checkboxlist to a function in a public class.

all i want is to list the selected checkboxlist items. Can anyone help please?

thanks,

Sam
webform code:
    
    <asp:CheckBoxList ID="CheckBoxList1" runat="server">
        <asp:ListItem>item1</asp:ListItem>
        <asp:ListItem>item2</asp:ListItem>
        <asp:ListItem>item3</asp:ListItem>
    </asp:CheckBoxList>

<asp:ObjectDataSource ID="odsTest" runat="server" SelectMethod="PopulateGridview" 
        TypeName="Paging.Subwin" SortParameterName="sortExpr" 
        SelectCountMethod="SelectCount" EnablePaging="True">
    <SelectParameters>
<asp:ControlParameter ControlID="CheckBoxList1" 
            Name="WellContainmentString" PropertyName="SelectedValue" Type="String" /></SelectParameters>

    </asp:ObjectDataSource>

public class code:

namespace Paging
{
    public partial class Subwin
    {
        
        public IQueryable PopulateGridview(string WellContainmentString)
        {

list selected checkbox values here!
}
}
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Sudhakar Pulivarthi
Sudhakar Pulivarthi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of OTM
OTM

ASKER

the second link pointed me in the right direction, i ended up listing the selected items in a textbox with a ';', adding that as a string ControlParameter to the ObjectDataSource and splitting the string into an array at the other end.