J
Justin Dutoit
Hi folks. I've been learning about the DetailsView, and its Insert function.
I get a null reference from e.Values["whatever"].
My markup/code is below-
<aspetailsView runat="server" ID="basketdetails"
OnItemInserting="DoInsert"
DefaultMode="Insert" AutoGenerateRows="true"
AutoGenerateInsertButton="true"
DataKeyNames="BasketNumber"
HeaderStyle-CssClass="header"
RowStyle-CssClass="rowblue"
AlternatingRowStyle-CssClass="altrowblue">
</aspetailsView>
protected void DoInsert(object src, DetailsViewInsertEventArgs e)
{
info.Text = e.Values["CustomerNumber"].ToString() + " " +
e.Values["Total"].ToString() + " " +
e.Values["DateTimeBasketFinished"].ToString() + " " +
e.Values["Notes"].ToString() + ".";
}
All the key values (customernumber, total, datetimebasketfinished, notes)
exist in the data source for the detailsview. e.Values.Count equals zero.
I'd appreciate any help on why the Values are not being populated- perhaps
if someone can post some working code which I can emulate.
Thanks a lot!
Justin Dutoit
I get a null reference from e.Values["whatever"].
My markup/code is below-
<aspetailsView runat="server" ID="basketdetails"
OnItemInserting="DoInsert"
DefaultMode="Insert" AutoGenerateRows="true"
AutoGenerateInsertButton="true"
DataKeyNames="BasketNumber"
HeaderStyle-CssClass="header"
RowStyle-CssClass="rowblue"
AlternatingRowStyle-CssClass="altrowblue">
</aspetailsView>
protected void DoInsert(object src, DetailsViewInsertEventArgs e)
{
info.Text = e.Values["CustomerNumber"].ToString() + " " +
e.Values["Total"].ToString() + " " +
e.Values["DateTimeBasketFinished"].ToString() + " " +
e.Values["Notes"].ToString() + ".";
}
All the key values (customernumber, total, datetimebasketfinished, notes)
exist in the data source for the detailsview. e.Values.Count equals zero.
I'd appreciate any help on why the Values are not being populated- perhaps
if someone can post some working code which I can emulate.
Thanks a lot!
Justin Dutoit