所以我有一个员工列表的网格视图。用户可以选择员工并对员工执行各种任务,包括删除此列表中的员工。在用户完成选择该员工后,我尝试更新网格视图。它只是空白。我希望它能提供更新的员工名单。这很奇怪,因为当页面加载时,gridview 是正确的。
我已经包含了我的 Page_Load 和将用户发送回 gridview 的方法之一。
protected void Page_Load(object sender, EventArgs e)
{
if (EmployeeWrapper.GetSessionWrapper() == null)
{
ddlArea.Visible = true;
lblArea.Text = ddlArea.Text;
}
else lblArea.Text = EmployeeWrapper.GetSessionWrapper().Name;
string test = "SELECT [EmployeeName], [BeginTime], [Task_Name] FROM [ActiveTaskView] WHERE ([Area] = '" + lblArea.Text + "')";
SqlDataSource1.SelectCommand = test;
}
protected void cmdCancel_Click(object sender, EventArgs e)
{
lblName.Enabled = false;
lblName.Text = "";
lblNewTask.Visible = false;
lblSta.Visible = false;
ddlNewTask.Visible = false;
txtStartTime.Visible = false;
cmdStart.Visible = false;
cmdCancel.Visible = false;
string test = "SELECT [EmployeeName], [BeginTime], [Task_Name] FROM [ActiveTaskView] WHERE ([Area] = '" + ddlArea.Text + "')";
SqlDataSource1.SelectCommand = test;
}