So I have a gridview of a list of employees. An user can select an employee and do various tasks with the employee, including deleting an employee in this list. I try to update the gridview after an user is done selecting that employee. It just comes up blank. I would like it to come up with the updated list of employees. This is odd because when the page loads the gridview is correct.
I have include my Page_Load and one of the methods that sends the user back to the 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;
}
After whatever operations you want to do. call gridView.DataBind();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.