我有一个包含搜索输入和提交按钮的gridview。问题是,如果使用相同的搜索条件单击两次SelectMethod,则不会触发。因此,我无法从数据库中获取新数据。我很确定它正在缓存请求。问题是我不知道如何解决它。我试图在ObjectDataSource上禁用缓存,但它不起作用
<asp:Button ID="btnSearch" runat="server" CssClass="button floatr" Text="Search" />
<asp:GridView ID="GridView1" runat="server" CssClass="extendedGridView" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="ObjectDataSource2"
EmptyDataText="No Records Found"> ... </asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetTransaction" TypeName="Tx.Class.HelperFunctions">
<SelectParameters>
<asp:ControlParameter ControlID="tbxSearchTransactionType" Name="transactionType" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="tbxStartDate" Name="startDate" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="tbxEndDate" Name="endDate" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
HelperFunctions.cs中的代码:
public IEnumerable<Transaction> GetTransaction(String transactionType,String startDate, String endDate)
{ ... }