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
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