Reputation: 75
Ahoy!
I am using an ASP.NET GridView control bound to an ObjectDataSource:
<asp:ObjectDataSource ID="Things" runat="server"
TypeName="BLL.Thing"
UpdateMethod="UpdateThing"
OnUpdating="Things_Updating"
OnUpdated="Things_Updated">
<UpdateParameters>
<asp:SessionParameter
Name="userContext"
SessionField="UserContext"
Type="Object" />
<asp:Parameter Name="thing" Type="Object" />
</UpdateParameters>
</asp:ObjectDataSource>
Clicking on an ImageButton control with CommandName="Update" causes the specified OnUpdating event to occur, but not the specified UpdateMethod or the OnUpdated event.
<EditItemTemplate>
<asp:ImageButton ID="ImageButton_Save" runat="server"
CommandName="Update"
SkinID="Save"
CausesValidation="false"
CommandArgument='<%# Eval("Id") %>' />
<asp:ImageButton ID="ImageButton_Cancel" runat="server"
CommandName="Cancel"
SkinID="Cancel"
CausesValidation="false" />
</EditItemTemplate>
The input parameters are defined in the OnUpdating event like so:
protected void Things_Updating(object sender, ObjectDataSourceMethodEventArgs e)
{
e.InputParameters["thing"] = _theThing;
}
No exception is thrown. The page just posts back with the EditItemTemplate controls still showing. I can put breakpoints all over the place, but the trail stops at the end of Things_Updating. It seems that some exception is happening which is not handled or caught by the debugger. Is there a way to open the hood and see what ASP.NET is doing (or failing to do)?
Thanks in advance!
Upvotes: 2
Views: 2257
Reputation: 4392
Does BLL.Thing.UpdateThing()
execute? This should occur after Things.Updating
and be easily debug-able. Also if there is something causing an exception, that is probably it.
Edit:
Try adding the parameter in a handler for GridView.RowUpdating
instead of ObjectDataSource.Updating
. That is how I usually do it. I think you need to get the DataSourceView
to modify the update parameters in the ObjectDataSource
's event. (See: ObjectDataSource Gridview Insert Fails W/ Empty Values Dictionary)
protected void gridThings_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
e.NewValues.Add("thing", _theThing);
}
Upvotes: 2
Reputation: 11433
Two things come to mind that could cause the progress to stop right there:
You've handled he GridView.RowUpdating
event as well, and set the GridViewUpdateEventArgs.Cancel
property to true. Something like this:
protected void myGridView_RowUpdating(Object sender, GridViewUpdateEventArgs e)
{
e.Cancel = true;
}
You've done something similar in the ObjectDataSource.Updating
event, setting the ObjectDataSourceMethodEventArgs.Cancel
property to false. Like this:
private void myObjectDataSource_Updating(object source, ObjectDataSourceMethodEventArgs e)
{
e.Cancel = true;
}
Either of these will halt the update process, causing something like what you're describing.
Upvotes: 1