K
Kevin
Hi my name is Kevin
I am currently working on a Asp 2.0 project
and im having some ObjectDataSource Problems
The thing is i have a Class called User
and a Bussiness Logic Layer FcUser with the functions GetAllUsers,
GetUserByID(int) and a InsertUser(BoUser as User), the both return a generic
list of User objects, the insert method sends a User object from my UI
provided by the ObjectDatasource
On my webform im using a gridview to show all the Users by Name and i setted
the datakeysnames property
on the Primary key of my User Table, then when i select a User i will call
the details in a detailgridview wich is on the same page with the
SelectUserByID from my BL layer
Now this works, i see the details on my detail grid view
next i want to add a new user so i select Insert
My insertItemTemplate shows up, so now i can enter the data in my bound
Fields
(they are all correctly bound to the properties of my user object my User
object holds a Firstname, lastname,... and a location object)
Now the problem is that my User object also holds a location wich in my
Database is an ID and in my App is a Location Object
And i want to select a new Location to put the User in
So i have on my insertitemtemplate a dropdownlist wich selects all locations
from my database in a collection of location objects
and has a seperate objectdatasource just to select all locations ion my DB
Now when i debug or enter the method insertUser
all my fields are filled in correctly but the location object under my
object User is "nothing" and i have selected a location from the
dropdownlist
and setted the value in the LocationID and the datatextfield on LocationName
This is weird because normally the parameters from a insert or update method
will hold the values selected with the select method
Maybe someone could tell me how to enter the location Object in the User
object when i insert a User, so that when i look at the User object when
inserting a user, the property Location (wich is type Location object) hols
the selected object from the location Dropdownlist
Kind regards
Kevin Vercauteren
I am currently working on a Asp 2.0 project
and im having some ObjectDataSource Problems
The thing is i have a Class called User
and a Bussiness Logic Layer FcUser with the functions GetAllUsers,
GetUserByID(int) and a InsertUser(BoUser as User), the both return a generic
list of User objects, the insert method sends a User object from my UI
provided by the ObjectDatasource
On my webform im using a gridview to show all the Users by Name and i setted
the datakeysnames property
on the Primary key of my User Table, then when i select a User i will call
the details in a detailgridview wich is on the same page with the
SelectUserByID from my BL layer
Now this works, i see the details on my detail grid view
next i want to add a new user so i select Insert
My insertItemTemplate shows up, so now i can enter the data in my bound
Fields
(they are all correctly bound to the properties of my user object my User
object holds a Firstname, lastname,... and a location object)
Now the problem is that my User object also holds a location wich in my
Database is an ID and in my App is a Location Object
And i want to select a new Location to put the User in
So i have on my insertitemtemplate a dropdownlist wich selects all locations
from my database in a collection of location objects
and has a seperate objectdatasource just to select all locations ion my DB
Now when i debug or enter the method insertUser
all my fields are filled in correctly but the location object under my
object User is "nothing" and i have selected a location from the
dropdownlist
and setted the value in the LocationID and the datatextfield on LocationName
This is weird because normally the parameters from a insert or update method
will hold the values selected with the select method
Maybe someone could tell me how to enter the location Object in the User
object when i insert a User, so that when i look at the User object when
inserting a user, the property Location (wich is type Location object) hols
the selected object from the location Dropdownlist
Kind regards
Kevin Vercauteren