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

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top