ObjectDataSource not calling BLL

T

Tides

My new page just won't fire the Update, Insert or Delete function on
the BLL.
I'm newish to ASP.NET and this may be a simple thing I have forgotten,
but its driving me up the wall.
I have other pages that work fine for this functionality.

Here is the ObjectDataSource:

<asp:ObjectDataSource ID="StaffDetailsDataSource" runat="server"
DeleteMethod="DeleteStaff" InsertMethod="InsertStaff"
OldValuesParameterFormatString=""
SelectMethod="GetStaffByStaffID"
TypeName="StaffBLL" UpdateMethod="UpdateStaff">
<DeleteParameters>
<asp:parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:parameter Name="ID" Type="Int32" />
<asp:parameter Name="CompanyID" Type="Int32" />
<asp:parameter Name="LoginName" Type="String" />
<asp:parameter Name="FirstName" Type="String" />
<asp:parameter Name="LastName" Type="String" />
<asp:parameter Name="ChargeRate" Type="Decimal" />
<asp:parameter Name="Position" Type="String" />
<asp:parameter Name="Gender" Type="String" />
<asp:parameter Name="Birthday" Type="DateTime" />
<asp:parameter Name="AccessLevel" Type="Int32" />
<asp:parameter Name="AlarmCode" Type="String" />
<asp:parameter Name="Notes" Type="String" />
<asp:parameter Name="AddressDetailsID" Type="Int32" />
<asp:parameter Name="BankDetailsID" Type="Int32" />
<asp:parameter Name="LoginEmailAddress" Type="String" />
<asp:parameter Name="Image" Type="Object" />
</UpdateParameters>
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="ID"
Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:parameter Name="CompanyID" Type="Int32" />
<asp:parameter Name="LoginName" Type="String" />
<asp:parameter Name="FirstName" Type="String" />
<asp:parameter Name="LastName" Type="String" />
<asp:parameter Name="ChargeRate" Type="Decimal" />
<asp:parameter Name="Position" Type="String" />
<asp:parameter Name="Gender" Type="String" />
<asp:parameter Name="Birthday" Type="DateTime" />
<asp:parameter Name="AccessLevel" Type="Int32" />
<asp:parameter Name="AlarmCode" Type="String" />
<asp:parameter Name="Notes" Type="String" />
<asp:parameter Name="AddressDetailsID" Type="Int32" />
<asp:parameter Name="BankDetailsID" Type="Int32" />
<asp:parameter Name="LoginEmailAddress" Type="String" />
<asp:parameter Name="Image" Type="Object" />
</InsertParameters>
</asp:ObjectDataSource>

This is linked to a DetailsView that loads the data correctly.
Please let me know if you can help.
 
S

Stan

My new page just won't fire the Update, Insert or Delete function on
the BLL.
I'm newish to ASP.NET and this may be a simple thing I have forgotten,
but its driving me up the wall.
I have other pages that work fine for this functionality.

Here is the ObjectDataSource:

    <asp:ObjectDataSource ID="StaffDetailsDataSource" runat="server"
        DeleteMethod="DeleteStaff" InsertMethod="InsertStaff"
        OldValuesParameterFormatString=""
SelectMethod="GetStaffByStaffID"
        TypeName="StaffBLL" UpdateMethod="UpdateStaff">
        <DeleteParameters>
            <asp:parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:parameter Name="ID" Type="Int32" />
            <asp:parameter Name="CompanyID" Type="Int32" />
            <asp:parameter Name="LoginName" Type="String" />
            <asp:parameter Name="FirstName" Type="String" />
            <asp:parameter Name="LastName" Type="String" />
            <asp:parameter Name="ChargeRate" Type="Decimal" />
            <asp:parameter Name="Position" Type="String" />
            <asp:parameter Name="Gender" Type="String" />
            <asp:parameter Name="Birthday" Type="DateTime" />
            <asp:parameter Name="AccessLevel" Type="Int32" />
            <asp:parameter Name="AlarmCode" Type="String" />
            <asp:parameter Name="Notes" Type="String" />
            <asp:parameter Name="AddressDetailsID" Type="Int32" />
            <asp:parameter Name="BankDetailsID" Type="Int32" />
            <asp:parameter Name="LoginEmailAddress" Type="String" />
            <asp:parameter Name="Image" Type="Object" />
        </UpdateParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="ID" QueryStringField="ID"
Type="Int32" />
        </SelectParameters>
        <InsertParameters>
            <asp:parameter Name="CompanyID" Type="Int32" />
            <asp:parameter Name="LoginName" Type="String" />
            <asp:parameter Name="FirstName" Type="String" />
            <asp:parameter Name="LastName" Type="String" />
            <asp:parameter Name="ChargeRate" Type="Decimal" />
            <asp:parameter Name="Position" Type="String" />
            <asp:parameter Name="Gender" Type="String" />
            <asp:parameter Name="Birthday" Type="DateTime" />
            <asp:parameter Name="AccessLevel" Type="Int32" />
            <asp:parameter Name="AlarmCode" Type="String" />
            <asp:parameter Name="Notes" Type="String" />
            <asp:parameter Name="AddressDetailsID" Type="Int32" />
            <asp:parameter Name="BankDetailsID" Type="Int32" />
            <asp:parameter Name="LoginEmailAddress" Type="String" />
            <asp:parameter Name="Image" Type="Object" />
        </InsertParameters>
    </asp:ObjectDataSource>

This is linked to a DetailsView that loads the data correctly.
Please let me know if you can help.

The problem is more likely to be with the DetailsView control rather
than the ObjectDataSource. It may work OK in ReadOnly mode but a lot
can go wrong in the Edit/Insert modes if it isn't set up properly.

Show us the mark-up for it and maybe we can help.
 
S

Stan

My new page just won't fire the Update, Insert or Delete function on
the BLL.
I'm newish to ASP.NET and this may be a simple thing I have forgotten,
but its driving me up the wall.
I have other pages that work fine for this functionality.

Here is the ObjectDataSource:

    <asp:ObjectDataSource ID="StaffDetailsDataSource" runat="server"
        DeleteMethod="DeleteStaff" InsertMethod="InsertStaff"
        OldValuesParameterFormatString=""
SelectMethod="GetStaffByStaffID"
        TypeName="StaffBLL" UpdateMethod="UpdateStaff">
        <DeleteParameters>
            <asp:parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:parameter Name="ID" Type="Int32" />
            <asp:parameter Name="CompanyID" Type="Int32" />
            <asp:parameter Name="LoginName" Type="String" />
            <asp:parameter Name="FirstName" Type="String" />
            <asp:parameter Name="LastName" Type="String" />
            <asp:parameter Name="ChargeRate" Type="Decimal" />
            <asp:parameter Name="Position" Type="String" />
            <asp:parameter Name="Gender" Type="String" />
            <asp:parameter Name="Birthday" Type="DateTime" />
            <asp:parameter Name="AccessLevel" Type="Int32" />
            <asp:parameter Name="AlarmCode" Type="String" />
            <asp:parameter Name="Notes" Type="String" />
            <asp:parameter Name="AddressDetailsID" Type="Int32" />
            <asp:parameter Name="BankDetailsID" Type="Int32" />
            <asp:parameter Name="LoginEmailAddress" Type="String" />
            <asp:parameter Name="Image" Type="Object" />
        </UpdateParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="ID" QueryStringField="ID"
Type="Int32" />
        </SelectParameters>
        <InsertParameters>
            <asp:parameter Name="CompanyID" Type="Int32" />
            <asp:parameter Name="LoginName" Type="String" />
            <asp:parameter Name="FirstName" Type="String" />
            <asp:parameter Name="LastName" Type="String" />
            <asp:parameter Name="ChargeRate" Type="Decimal" />
            <asp:parameter Name="Position" Type="String" />
            <asp:parameter Name="Gender" Type="String" />
            <asp:parameter Name="Birthday" Type="DateTime" />
            <asp:parameter Name="AccessLevel" Type="Int32" />
            <asp:parameter Name="AlarmCode" Type="String" />
            <asp:parameter Name="Notes" Type="String" />
            <asp:parameter Name="AddressDetailsID" Type="Int32" />
            <asp:parameter Name="BankDetailsID" Type="Int32" />
            <asp:parameter Name="LoginEmailAddress" Type="String" />
            <asp:parameter Name="Image" Type="Object" />
        </InsertParameters>
    </asp:ObjectDataSource>

This is linked to a DetailsView that loads the data correctly.
Please let me know if you can help.

Forget my last post, I've just spotted the trouble. According to your
mark-up you haven't defined the sources for the parameters in the
Delete, Insert and Update methods.

You need to link them to the your DetailsView control. If you are
using VS2005 then the easiest way is to use the wizard for defining
them. Go to the Properties window and click on the Parameters for each
method. You will then be presented with a list of parameters awaiting
allocation.

The end result should be something like this:

<UpdateParameters>
<asp:ControlParameter ControlID="YourDetailsView"
Name="CompanyID" PropertyName="SelectedValue"
Type="Int32" />

...
 
T

Tides

Thanks for the response. I have not used the ControlParameter before
and will give it a go, although in my other pages that work I do not
use them. Here is an example:

<asp:ObjectDataSource ID="AssetDetailsDataSource" runat="server"
SelectMethod="GetAssetByAssetID" TypeName="AssetsBLL"
DeleteMethod="DeleteAsset"
InsertMethod="InsertAsset" UpdateMethod="UpdateAsset" >
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="ID"
Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:parameter Name="SectionID" Type="Int32" />
<asp:parameter Name="Description" Type="String" />
<asp:parameter Name="Number" Type="Int32" />
<asp:parameter Name="PurchaseDate" Type="DateTime" />
<asp:parameter Name="ReviewDate" Type="DateTime" />
<asp:parameter Name="Condition" Type="String" />
<asp:parameter Name="PurchasePrice" Type="Decimal" />
<asp:parameter Name="Notes" Type="String" />
<asp:parameter Name="DepreciationPercentage"
Type="Decimal" />
<asp:parameter Name="DepreciationMonths" Type="Int32" />
<asp:parameter Name="Image" Type="Object" />
<asp:parameter Name="ID" Type="Int32" />
<asp:SessionParameter Name="CompanyID"
SessionField="CompanyID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:parameter Name="SectionID" Type="Int32" />
<asp:parameter Name="Description" Type="String" />
<asp:parameter Name="Number" Type="Int32" />
<asp:parameter Name="PurchaseDate" Type="DateTime" />
<asp:parameter Name="ReviewDate" Type="DateTime" />
<asp:parameter Name="Condition" Type="String" />
<asp:parameter Name="PurchasePrice" Type="Decimal" />
<asp:parameter Name="Notes" Type="String" />
<asp:parameter Name="DepreciationPercentage"
Type="Decimal" />
<asp:parameter Name="DepreciationMonths" Type="Int32" />
<asp:parameter Name="Image" Type="Object" />
<asp:SessionParameter Name="CompanyID"
SessionField="CompanyID" Type="Int32" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:DetailsView
ID="dvDetails"
runat="server"
AutoGenerateRows="False"
DataSourceID="AssetDetailsDataSource"
DataKeyNames="ID"
width="75%">

And just for reference, here is the top of the details view for
StaffDetails:

<asp:DetailsView
ID="dvDetails"
runat="server"
AutoGenerateRows="False"
DataSourceID="StaffDetailsDataSource"
DataKeyNames="ID"
Width="75%">

The select is firing so the connection to the BLL, I would assume, is
fine in terms of namespace declaration.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top