C# 单击寻呼机后Listview未正确更新
我有一个列表视图、寻呼机和一个文本框,允许用户输入一个值来填充列表视图。在加载ListView时,如果输入一个值进行搜索,它将正常工作。但是,如果在加载时,在我单击寻呼机上的“下一步”后,我的搜索功能无法正常工作。我必须单击“搜索”按钮两次才能获得正确的结果: aspx:C# 单击寻呼机后Listview未正确更新,c#,asp.net,C#,Asp.net,我有一个列表视图、寻呼机和一个文本框,允许用户输入一个值来填充列表视图。在加载ListView时,如果输入一个值进行搜索,它将正常工作。但是,如果在加载时,在我单击寻呼机上的“下一步”后,我的搜索功能无法正常工作。我必须单击“搜索”按钮两次才能获得正确的结果: aspx: <asp:ListView ID="ReviewCaseStatusListView" runat="server" OnPagePropertiesChanging="ListEvents_PagePropertie
<asp:ListView ID="ReviewCaseStatusListView" runat="server" OnPagePropertiesChanging="ListEvents_PagePropertiesChanging" >
protected void BindListView()
{
CaseUploadHistoryLabel.Visible = false;
using (var Apptestconn = new SqlConnection(ConfigurationManager.ConnectionStrings["Apptestconn"].ConnectionString))
{
Apptestconn.Open();
if (CaseStatusDropDownList.SelectedValue == "" & CaseNumberTextBox.Text == "" & StartDateTextBox.Text == "" & EndDateTextBox.Text == "")
{
using (SqlCommand cmdGetAllCaseInformationSP = new SqlCommand("GetAllCaseInformationSP", Apptestconn))
{
cmdGetAllCaseInformationSP.CommandType = CommandType.StoredProcedure;
cmdGetAllCaseInformationSP.Parameters.AddWithValue("@UserName", "nguyenlc");
cmdGetAllCaseInformationSP.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(cmdGetAllCaseInformationSP);
DataSet ds = new DataSet();
da.Fill(ds, "GetAllCaseInformationTable");
ReviewCaseStatusListView.DataSource = ds.Tables["GetAllCaseInformationTable"];
ReviewCaseStatusListView.DataBind();
if (ds.Tables["GetAllCaseInformationTable"].Rows.Count != 0)
{
CaseUploadHistoryLabel.Visible = true;
}
}
}
protected void ListEvents_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
{
//set current page startindex, max rows and rebind to false
DataPager pager = ReviewCaseStatusListView.FindControl("DataPager1") as DataPager;
pager.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
//rebind List View
BindListView();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindListView();
}
}
protected void SearchButton_Click(object sender, EventArgs e)
{
BindListView();
}
}