locked
Adding Parameters to ObjectDataSource? RRS feed

  • Question

  • User-885817678 posted

    Hi all, I have an objectdatasource that I need to add a parameter to.  The parameter should be pulled from a Checkbox on the page with an ID of CheckBox_SearchAllSites.  How would I do this?  Below is what I tried!

    ASP:

    <asp:ObjectDataSource runat="server" ID="ObjectDataSource_Employee"
    DataObjectTypeName="EnvirocorFacilityManagement.Database.Employee"
    SelectMethod="GetEmployeesDataSet"
    TypeName="EnvirocorFacilityManagement.Database.EmployeeDB"
    ConvertNullToDBNull="True" DeleteMethod="DeleteEmployee"
    InsertMethod="InsertEmployee" OldValuesParameterFormatString="original_{0}"
    UpdateMethod="UpdateEmployee">
    <SelectParameters>
    <asp:ControlParameter ControlID ="CheckBox_SelectAllSites" Type="Boolean" Name="includeAllSites" DefaultValue="false" />
    </SelectParameters>
    </asp:ObjectDataSource>

    c# Code:

    public DataSet GetEmployeesDataSet(bool includeAllSites)
    {
    return (DataSet)GetEmployees(null, true, includeAllSites);
    }

    Tuesday, August 5, 2014 12:22 PM

Answers

  • User-1360095595 posted

    <asp:ControlParameter ControlID ="CheckBox_SelectAllSites" Type="Boolean" Name="includeAllSites" DefaultValue="false" />

    Try adding: PropertyName="Checked"

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 5, 2014 12:28 PM