S
studio60podcast
I'm defining the ItemUpdating event for a DetailsView control, but when
I try to access the e.NewValues collection, it's throwing a
NULLReference exception. Any thoughts?
<aspetailsView id="dvConsultantDetails" runat="server"
GridLines="none" CssClass="textBlue12"
AutoGenerateRows="false" DefaultMode="Edit"
OnModeChanging="dvConsultantDetails_ModeChanging"
OnItemUpdating="dvConsultantDetails_ItemUpdating">
<Fields>
<asp:BoundField DataField="name" HeaderText="Name">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="abbr" HeaderText="Abbreviation">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="vid" HeaderText="Vendor ID">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="address" HeaderText="Address">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="phone" HeaderText="Phone">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="fax" HeaderText="Fax">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="email" HeaderText="E-Mail">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:CommandField ButtonType="Button" ShowEditButton="True">
<ControlStyle CssClass="formField" />
</asp:commandfield>
</Fields>
</aspetailsView>
protected void dvConsultantDetails_ItemUpdating(object sender,
DetailsViewUpdateEventArgs e)
{
string lsName = e.NewValues["name"].ToString();
}
I try to access the e.NewValues collection, it's throwing a
NULLReference exception. Any thoughts?
<aspetailsView id="dvConsultantDetails" runat="server"
GridLines="none" CssClass="textBlue12"
AutoGenerateRows="false" DefaultMode="Edit"
OnModeChanging="dvConsultantDetails_ModeChanging"
OnItemUpdating="dvConsultantDetails_ItemUpdating">
<Fields>
<asp:BoundField DataField="name" HeaderText="Name">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="abbr" HeaderText="Abbreviation">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="vid" HeaderText="Vendor ID">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="address" HeaderText="Address">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="phone" HeaderText="Phone">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="fax" HeaderText="Fax">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:BoundField DataField="email" HeaderText="E-Mail">
<ControlStyle CssClass="formField" width="305" />
<HeaderStyle CssClass="formField" Width="100" />
</asp:boundfield>
<asp:CommandField ButtonType="Button" ShowEditButton="True">
<ControlStyle CssClass="formField" />
</asp:commandfield>
</Fields>
</aspetailsView>
protected void dvConsultantDetails_ItemUpdating(object sender,
DetailsViewUpdateEventArgs e)
{
string lsName = e.NewValues["name"].ToString();
}