Alessandro -- thank you again. Still not able to get this to work. Let me include relevant code so that you or others might see where I'm going astray. I'm using a datacontext for the execution of the updates, which are accomplished via stored procedure. Within the stored proc I have defined the transaction commits and rollback logic.
On the page:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Myconnectionstring" SelectCommand="getQtyOnHand" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="Myconnectionstring" SelectCommand="getPartDetail" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
<asp:GridView ID="grdViewInventory" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="partNumber" DataSourceID="SqlDataSource1" ...> ... </asp:GridView>
<asp:DetailsView ID="dvwPart" runat="server" AutoGenerateRows="False" DataKeyNames="partID" DataSourceID="SqlDataSource2" ...> ... </asp:DetailsView>
The above portray a high level grid view of inventory by part, and a detailed view of part information when a part is selected in the grid view. This works fine. The objective is to refresh the gridview after the database changes as a result of other actions the user takes on this same page, which are handled in button handlers like the following:
Dim selectedQty As Integer = CInt(txtQty.Text)
Dim selectedPartID As Integer = dvwPart.SelectedValue
Dim selectedOfficeID As Integer = CInt(grdOfficePartView.DataKeys(grdOfficePartView.SelectedIndex).Values("officeID"))
Dim targetOfficeID As Integer = lstOffice.SelectedValue
Dim returnCode As Integer = 0
'Here's the actual transfer processing -- the transferInventory stored proc works correctly, updates the database, commits the transaction, etc.
Dim dcInventory As New InventoryDataContext()
returnCode = dcInventory.transferInventory(lblUserName.Text, selectedPartID, selectedQty, selectedOfficeID, targetOfficeID)
if returnCode <> 0 then
'Handle error, etc.
else
'Rebind the appropriate grid
grdOfficePartView.DataBind()
grdOfficePartView.SelectedIndex = -1
dvwPart.DataBind()
end if
The rebind logic is run through, but has no impact on the visual display. When I change the view through any other means, the database changes are reflected in the refreshed grid, but not when I "force" the databind as above.