FormView insert: can't get it to work programmatically

G

Guest

Hi,

I am trying to use the ASP.NET 2.0 FormView as a method to enter data into
my business object.
At the moment, I am trying to do this without a custom DataSourceView
control, but I can't seem to get it working.

I have this code in my Page_Load method (unconditionally, i.e. outside of
ans "if !IsPostBack" blocks):
ctlView.DataSource = currentAccount.GetAccounts();
ctlView.DataMember = "Name";
ctlView.DataBind();
where GetAccounts returns a (disconneced) DataSet Table object with one
record in it.
The "ItemTemplate" and "InsertItemTemplate" templates are identical. If I
use the FormView to display the record, all fields are filled (using the <%
#Bind("fieldname") %> declaration in the aspx page).
The Insert Command starts fine, but when I receive the "Item_Inerting"
event, the values collection is empty.
I tried everything I can think of (adding event handlers, surrounding any of
the above lines with "if !IsPostBack"), but the values collection remains
empty.
I even renamed one of the field names inside the INsertItemTemplate to a
nonsense vale, but no error shows up.
It seems that the FormView is not at all interested in my data structure,
and it does not ask me for one...
I'm totally lost, although data binding in 1.0 was no problem to me.

What is the exact way to get the values entered on the web page to be
included in the values collection ?

thanks for any suggestion
Guenter
DataBindin
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top