is there a way to pass my object

G

Guest

hey all,
i'm in the code-behind for my web page and i have a gridview bound to a
custom object. i have an add new record on the footer template.

my custom object accepts an Employee object but i'm not sure how to pass this:
i'm thinking something like this but it's not working.
Me.ObjectDataSource1.InsertParameters.Add(Employee)

any ideas?
thanks,
rodchar
 
G

Guest

yeah but the grid view doesn't have a native Insert does it?

what i had to do was this:
If e.CommandName = "AddNew" Then
Dim lastName As String =
DirectCast(GridView1.FooterRow.FindControl("TxInsLastName"), TextBox).Text
Dim firstName As String =
DirectCast(GridView1.FooterRow.FindControl("TxInsFirstName"), TextBox).Text
Dim emp As New Employee
emp.LastName = lastName
emp.FirstName = firstName
emp.InsertEmployee()
Me.GridView1.DataBind()
End If

Am i missing something?
thanks,
rodchar
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top