D
deftone
I am trying to do something that to me sounds simple, but yet I have
struggled over it for several days. My goal is to use a formview to
edit a record. The datasource of the formview is a simple dataset with
1 table and several records. I have no problem getting the data to
display in the form. When I make an edit and submit, the formview
will postback and displays the updates within the fields, however the
ItemUpdating sub is telling me it found no changes and has nothing to
update the dataset with. I have broken down the code below. Any help
would be greatly appreciated.
The formview has a single DataKeyNames set to it. It is not being
databound after a postback.
--- submit button
<asp:ImageButton ID="btnRecordSave" runat="server" ImageUrl="~/Images/
btn_save.png" />
--- formview
<asp:FormView ID="fvDetails" runat="server">
<EditItemTemplate> ...bunch of bound input fields </
EditItemTemplate>
</asp:FormView>
--- handle submit click
Private Sub btnRecordSave_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles btnRecordSave.Click
fvDetails.UpdateItem(True)
End Sub
--- formview item updating sub
Private Sub fvDetails_ItemUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewUpdateEventArgs) Handles
fvDetails.ItemUpdating
lblPageInfo.Text &= "<br>oldvalues=" & e.OldValues.Count
lblPageInfo.Text &= "<br>keys=" & e.Keys.Count
lblPageInfo.Text &= "<br>newvalues=" & e.NewValues.Count
End Sub
struggled over it for several days. My goal is to use a formview to
edit a record. The datasource of the formview is a simple dataset with
1 table and several records. I have no problem getting the data to
display in the form. When I make an edit and submit, the formview
will postback and displays the updates within the fields, however the
ItemUpdating sub is telling me it found no changes and has nothing to
update the dataset with. I have broken down the code below. Any help
would be greatly appreciated.
The formview has a single DataKeyNames set to it. It is not being
databound after a postback.
--- submit button
<asp:ImageButton ID="btnRecordSave" runat="server" ImageUrl="~/Images/
btn_save.png" />
--- formview
<asp:FormView ID="fvDetails" runat="server">
<EditItemTemplate> ...bunch of bound input fields </
EditItemTemplate>
</asp:FormView>
--- handle submit click
Private Sub btnRecordSave_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles btnRecordSave.Click
fvDetails.UpdateItem(True)
End Sub
--- formview item updating sub
Private Sub fvDetails_ItemUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewUpdateEventArgs) Handles
fvDetails.ItemUpdating
lblPageInfo.Text &= "<br>oldvalues=" & e.OldValues.Count
lblPageInfo.Text &= "<br>keys=" & e.Keys.Count
lblPageInfo.Text &= "<br>newvalues=" & e.NewValues.Count
End Sub