Link to home
Start Free TrialLog in
Avatar of Scarlett72
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'  

 <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>

Open in new window

     
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";
        }

Open in new window


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!
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

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
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America 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 Scarlett72
Scarlett72

ASKER

Thanks Kyle, apologize for the delay responding got pulled away on another project, took some time for me to get back to this.