Last post Aug 05, 2014 12:28 PM by MetalAsp.Net
Member
2 Points
25 Posts
Aug 05, 2014 12:22 PM|aidenkael|LINK
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); }
C objectdatasource
All-Star
101931 Points
20703 Posts
Moderator
Aug 05, 2014 12:28 PM|MetalAsp.Net|LINK
aidenkael <asp:ControlParameter ControlID ="CheckBox_SelectAllSites" Type="Boolean" Name="includeAllSites" DefaultValue="false" />
Try adding: PropertyName="Checked"
Member
2 Points
25 Posts
Adding Parameters to ObjectDataSource?
Aug 05, 2014 12:22 PM|aidenkael|LINK
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);
}
C objectdatasource
All-Star
101931 Points
20703 Posts
Moderator
Re: Adding Parameters to ObjectDataSource?
Aug 05, 2014 12:28 PM|MetalAsp.Net|LINK
Try adding: PropertyName="Checked"
C objectdatasource