好吧,我让它工作了,但是以一种非常奇怪的方式。
如果我同时使用 QueryStringParameter 和 SessionParameter,那么它可以“正常”工作。
<asp:SqlDataSource ID="DataSourcePFEP" runat="server"
ConnectionString="<%$ ConnectionStrings:DALI %>" ProviderName="Oracle.ManagedDataAccess.Client" CancelSelectOnNullParameter="false">
<SelectParameters>
<asp:SessionParameter Name="PlantID" SessionField="PlantID" />
<asp:QueryStringParameter Name="ProductionLine" QueryStringField="Line" ConvertEmptyStringToNull="true" />
<asp:SessionParameter Name="ProductionLine" SessionField="ProductionLine" />
</SelectParameters>
</asp:SqlDataSource>
为此,我需要将 Session["ProductionLine"] 设置为 PageLoad 上的查询字符串。但如果我只使用SessionParameter,那么它也不起作用。出于某种原因,如果我同时使用两者,那么它会以某种方式起作用。
我不知道为什么,这似乎是一个奇怪的解决方法,但只是把它留在这里。也许有人可以用它来找出真正的问题,或者至少像我一样用它来解决它。