如何更改我的selecommand,并在页面的其余部分(使用分页,排序时)保留它?使用代码隐藏访问selectcommand
我有一个复选框页:
<input type="checkbox" name="checkbox_1" />
<input type="checkbox" name="checkbox_2" />
<input type="checkbox" name="checkbox_3" />
<asp:Button runat="server" Id="CustomButton" text="Create Report" PostBackUrl="report.aspx?"/>
然后在report.aspx我要生成基于复选框的选择标准列表视图。
<asp:ListView runat="server" ID="ReportListView" DataSourceID="ReportListViewSDS">
<LayoutTemplate runat="server">
...<asp:PlaceHolder runat="server" ID="itemPlaceHolder" />...
</LayoutTemplate>
<ItemTemplate>
...
</ItemTemplate>
</asp:ListView>
我希望能够对该列表视图进行排序和分页。这是什么,我想在后面的代码的想法:
Protected Sub ReportListView_PreRender(ByVal sender As Object, ByVal e As System.EventArgs)
' What's the correct way to reference the listview?
' When I use the below code i get "ReportListView is not declared...."
' ReportListView.SqlCommand = "SELECT " & checkbox1 & ", " & checkbox2 & " WHERE..."
End Sub
我不知道如果我即使在这个正确的方向前进,任何帮助表示赞赏。当我将分页或排序应用到列表视图时,我对PreRender函数中的sql命令所做的更改会保留吗?
苏里,我的问题不是很清楚。我熟悉标准列表视图,并使用“选择”命令和您提到的参数。但我的目标是选择查询将具有来自Request.From的条目(即前面的页面复选框)。我发现我让它变得更加困难。查看下面的解决方案。 – russds