473,320 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ObjectDataSource not calling BLL

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.
Jun 27 '08 #1
3 1279
On 25 Apr, 10:26, Tides <andyt...@gmail.comwrote:
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.
Jun 27 '08 #2
On 25 Apr, 10:26, Tides <andyt...@gmail.comwrote:
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" />

...
Jun 27 '08 #3

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.
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
4
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void...
3
by: mthomason | last post by:
I keep getting this error when trying to update records using an ObjectDataSource. I have seen others post similar errors...but I haven't found any solutions. ObjectDataSource...
0
by: David Hubbard | last post by:
I am using a GridView to display a set of objects that have a parent-child relationship. Each object, MyBO, has an ID property that is used to get the children of that object. class MyBO { ...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
0
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to...
0
by: sugarnet | last post by:
Hi, I have a detailsview that contains templated fields. In the Edit/Insert mode, I would like to populate my DropDown from an ObjectDataSource. The data I need comes from a webservice that I'm...
0
by: Steve Kershaw | last post by:
Hi, I'm using the GridView RowUpdating() event to catch the ObjectDataSource before it actually calls the Update() method. I need to be able to STOP the ObjectDataSource from calling the Update()...
0
by: cmrchs | last post by:
Hi, I'm trying out Databinding to a Data Acces Layer using a GridView and ObjectDataSource-control The Update works fine but the Delete-method doesn't ??? <asp:GridView ID="GridView1"...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.