JohnPete22
JohnPete22

Reputation: 523

ASP ObjectDataSource binding even though DataBind() not called

I've recently run into an issue with my ASP ObjectDataSource using a GridView.

My code.....

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnablePaging="True" OldValuesParameterFormatString="original_{0}" SelectCountMethod="GetRowCount" SelectMethod="CriteriaSearch" TypeName="AssemblyNameRemoved">
        <SelectParameters>              
          <asp:SessionParameter Name="criteria" SessionField="OrderCriteria" Type="Object" />                
            <asp:Parameter Direction="Output" Name="rowCount" Type="Int32" />
        </SelectParameters>
</asp:ObjectDataSource>


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" BorderColor="#CCCCCC" CellPadding="0" GridLines="None" Width="100%" AllowPaging="True" DataSourceID="ObjectDataSource1">
  //code removed for brevity
</asp:GridView>

Now, this code hasn't changed for quite some time. But we recently updated to .Net 4.8. And since then, before the Page_Load event even fires (where I will load up my criteria object and then DataBind the grid) the function CriteriaSearch is getting called, and then my Page_Load event fires and I end up calling DataBind() and the function will run again.

Edit: Code-behind has not changed in years either, and testing on old .Net framework this is not an issue.

I did some research on .Net framework 4.8 update, but nothing stuck out as to why this would have changed.

Any help/references would be appreciated. Thanks.

Upvotes: 0

Views: 121

Answers (0)

Related Questions