我需要使用 sqldatasource(stored proc) 来绑定 gridview。
<asp:GridView ID="gvBC" runat="server" AutoGenerateColumns="False" ShowFooter="True" AllowSorting="True" AllowPaging="True" pageSize ="3" DataSourceID="dsBCSearch">
<Columns>
<asp:BoundField DataField="ContactID" HeaderText="ContactID" Visible="false"/>
<asp:BoundField DataField="BldgNum" HeaderText="Bldg#" SortExpression="BldgNum" />
</Columns>
<EmptyDataTemplate> No Building Coordinator Found. </EmptyDataTemplate>
<EmptyDataRowStyle HorizontalAlign="Center" />
</asp:GridView>
<asp:SqlDataSource ID="dsBCSearch" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnStr %>" SelectCommand="GetBC" SelectCommandType="StoredProcedure"
SortParameterName="SortExpression" />
后面的代码:
protected void Page_Load(object sender, EventArgs e)
{
LoadBC();
}
protected void LoadBC()
{
dsBCSearch.SelectCommand = "GetBCwP";
dsBCSearch.SelectParameters.Clear();
dsBCSearch.SelectParameters.Add("LName", this.txtLNAme.Text.Trim());
dsBCSearch.SelectParameters.Add("Active", this.chkActive.Checked.ToString());
//dsBCSearch.SelectParameters.Add("sortExpression", this.gvBC.SortExpression);
dsBCSearch.SelectParameters.Add("startRowIndex", this.gvBC.PageIndex.ToString());
dsBCSearch.SelectParameters.Add("maximumRows", this.gvBC.PageSize.ToString());
this.gvBC.DataBind();
}
现在只渲染第一页(3 条记录),在页脚中没有显示数字。如何将分页添加到页脚?
谢谢