Link to home
Start Free TrialLog in
Avatar of JoseHidalgo
JoseHidalgoFlag for Costa Rica

asked on

Logical / Technical Problem with ASP gridview and objectdatasooruce

Hi Experts

Here is my problem: I have two buttons Dispatch / Update. When I click on Update button I need to update the code for Provider. When I click on Dispatch button it doesnt update the code for Provider.

Is there any way that in ODS when I click on dispatch call the update function and then the dispatch function.

the ODS only support one Update Method. Is possible to have more that one with different names.

Any help will be appreciated

I have this code with the buttons

 <asp:Button ID="btnUpdate" Text="Update" runat="server" CommandArgument="Update"
            CommandName="Update" />
        <asp:Button ID="btnDispatch" Text="Dispatch" runat="server" CommandArgument="Dispatch"
            CommandName="Dispatch" />

Open in new window


Then I have this ODS:

<asp:ObjectDataSource ID="odsDetail" runat="server" TypeName="DataAccess.WorkOrder"
    SelectMethod="getWODetails" UpdateMethod="updateWODetails">
    <SelectParameters>
        <asp:QueryStringParameter Name="WONum" Type="String" QueryStringField="WONum" />
        <asp:QueryStringParameter Name="SiteID" Type="String" QueryStringField="SiteID" />
        <asp:QueryStringParameter Name="OrgID" Type="String" QueryStringField="OrgID" />
    </SelectParameters>
    <UpdateParameters>
        <asp:QueryStringParameter QueryStringField="WoNum" Name="WoNum" Type="String" />
        <asp:QueryStringParameter Name="SiteId" Type="String" QueryStringField="SiteID" />
        <asp:Parameter Name="description" Type="String" />
        <asp:Parameter Name="WLoc" Type="String" />
        <asp:Parameter Name="AssetNum" Type="String" />
        <asp:Parameter Name="woPriority" Type="String" />
        <asp:Parameter Name="worktype" Type="String" />
        <asp:Parameter Name="details" Type="String" />
        <asp:Parameter Name="Location" Type="String" />
        <asp:Parameter Name="Asset" Type="String" />
        <asp:Parameter Name="Priority" Type="String" />
        <asp:Parameter Name="reportedby" Type="String" />
        <asp:Parameter Name="ProjNum" Type="String" />
        <asp:Parameter Name="reportdate" Type="String" />
        <asp:Parameter Name="provider" Type="String" />
    </UpdateParameters>
</asp:ObjectDataSource>

Open in new window


Finally the code that Updates the DB

case "Update":
                    string updmsg = string.Format("Work Order {0} has been updated successfully", Request.QueryString["WONum"]);
                    imsg.ShowMsg(updmsg, false); 
                    break;
                
                case "Dispatch":
                    
                    (new DataAccess.WorkOrder()).updateWOStatus(Request.QueryString["WONum"],"INPRG", Request.QueryString["SiteID"], Request.QueryString["OrgID"], (fvDetail.FindControl("txtreportedby") as RadTextBox).Text);
                    //Page.ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
                    string dismsg = string.Format("Work Order {0} has been dispatched successfully", Request.QueryString["WONum"]);
                    imsg.ShowMsg(dismsg, true);
                    break;

Open in new window

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

ASKER

Thanks