Scarlett72
asked on
How to set a selecting parameter for an ObjectDataSource
Hi I want to pass a parameter to a dataset in a typed dataset .xsd tableadapter. So when a user clicks on the button named 'Add' they will see the data associated with 'Add' and when they click on the button named 'Remove' they will see the data associated with 'Remove'
So I think I'm supposed to create a 'Selecting' event and do something like this:
I'm not really sure how to apply logic so when a user presses the add or remove button they are going to get the appropriate data ... any point in the right direction would really be appreciated!
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="RapidFire.RFTableAdapters.USP_RD_UPSELL_CALCTableAdapter" OnSelecting="ObjectDataSource2_Selecting">
<SelectParameters>
<asp:Parameter Name="action" ConvertEmptyStringToNull="true" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
So I think I'm supposed to create a 'Selecting' event and do something like this:
protected void ObjectDataSource2_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
e.InputParameters[""] = "Add";
}
I'm not really sure how to apply logic so when a user presses the add or remove button they are going to get the appropriate data ... any point in the right direction would really be appreciated!
It looks like you are heading in the right direction, but InputParameters doesn't have a name associated with it, and are you looking to determine which option was selected (Add or Remove)?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Kyle, apologize for the delay responding got pulled away on another project, took some time for me to get back to this.