Gridview不爽快

时间:2013-01-11 22:05:54

标签: c# asp.net gridview

所以我有一份员工清单的网格视图。用户可以选择员工并与员工执行各种任务,包括删除此列表中的员工。用户完成选择该员工后,我尝试更新gridview。它只是空白。我希望它能够提供最新的员工名单。这很奇怪,因为当页面加载时,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;
    }

1 个答案:

答案 0 :(得分:0)

在您想要做的任何操作之后。致电gridView.DataBind();