Link to home
Start Free TrialLog in
Avatar of tech_question
tech_question

asked on

how can I reset the parameter of an objectdatasource ?

I have two panels. The first panel saves the invoice information (header information).

The second panel saves the invoice lines for this invoice (a gridview with 1 or more lines).

on add of a new invoice, I save the invoice header and then return the invoice id without refreshing the page. The InvoiceID
which is bound to the ObjectDataSource does not get reset. How can I do this ?

The actual insert method (InsertInvoiceLines) is in the business object.

I tried using session variables, even a session variable is not being reset  and I cannot access a session variable in the business object. What other options do I have if I cannot reset the objectdatasource Parameter value ?

<asp:ObjectDataSource  ID="odsInvLines" TypeName="BusinessObject.Invoice" runat="server"
         OldValuesParameterFormatString="original{0}"  SelectMethod="GetInvoiceLinesByInvoiceID" InsertMethod="InsertInvoiceLines" UpdateMethod="UpdateInvoiceLines">
        <UpdateParameters>
        <asp:Parameter Name="InvoiceID" Type="Int64" /> 
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="Rev_Activity_Code_ID" Type="Int32" />
        <asp:Parameter Name="Quantity" Type="Int32" />
        <asp:Parameter Name="Unit_Selling_Price" Type="Double" />
        <asp:Parameter Name="Total_Amount" Type="Double" />
        <asp:Parameter Name="BEGIN_BILLING_PERIOD" Type="String" />
        <asp:Parameter Name="END_BILLING_PERIOD" Type="String" />
        <asp:Parameter Name="OriginalLine_Number" Type="Int64" />
        </UpdateParameters>
        
        <InsertParameters >
        <asp:Parameter Name="InvoiceID" Type="Int64" /> 
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="Rev_Activity_Code_ID" Type="Int32" />
        <asp:Parameter Name="Quantity" Type="Int32" />
        <asp:Parameter Name="Unit_Selling_Price" Type="Double" />
        <asp:Parameter Name="Total_Amount" Type="Double" />
        <asp:Parameter Name="BEGIN_BILLING_PERIOD" Type="String" />
        <asp:Parameter Name="END_BILLING_PERIOD" Type="String" />
        <asp:Parameter Name="OriginalLine_Number" DefaultValue="0"  Type="Int64" />
        </InsertParameters>
</asp:ObjectDataSource>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of GiftsonDJohn
GiftsonDJohn
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
SOLUTION
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