After upgrading to .NET 4.5, event in UserControl

2019-08-03 04:13发布

问题:

I have a stable application where one function suddenly stopped working, after upgrading from .NET 4 to .NET 4.5. The error has been isolated to an event not firing and it has been confirmed beyond any doubt (on 2 servers and 3 workstations), that this error only happens after the .NET 4.5 upgrade (and did not happen before).

I have the following:

  • An empty aspx that only contains a usercontrol (don't ask)
  • The user control contains a GridView that is loaded with content after a postback.
  • The GridView contains a LinkButton.
    • The Text comes from an Eval
    • It also has an OnDataBinding event that sets the CommandArgument
  • The GridView contains an OnRowCommand.

The event in the OnRowCommand is fired in .NET 4.0 and is not fired in .NET 4.5.

Any clues?

UPDATE

I simplified my code and got closer to the core of the problem. I found that it was caused by AllowCustomPaging="True" on the GridView. After removing this, the postback works fine.

回答1:

I simplified my code and got closer to the core of the problem. I found that it was caused by AllowCustomPaging="True" on the GridView. After removing this, the postback works fine.