예제 #1
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)//设置作业列表中各控件的可用状态,自动编号
    {
        if (e.Row.RowIndex != -1)
        {
            ((Label)(e.Row.Cells[0].FindControl("Lbl_zybh"))).Text = (e.Row.RowIndex + 1).ToString();
            string zuoyeid = GridView1.DataKeys[e.Row.RowIndex].Value.ToString().Trim();
            if (ZuoyeInfo.IsZuoyeUsed(zuoyeid))//如果作业已布置,则不允许修改题目
            {
                ((HyperLink)(e.Row.Cells[5].FindControl("HyperLink1"))).Enabled   = false;
                ((LinkButton)(e.Row.Cells[4].FindControl("LinkButton1"))).Enabled = false;
            }
            else
            {
                ((HyperLink)(e.Row.Cells[5].FindControl("HyperLink1"))).Enabled   = true;
                ((LinkButton)(e.Row.Cells[4].FindControl("LinkButton1"))).Enabled = true;
            }

            if (ZuoyeInfo.GetTimuCount(zuoyeid) <= 0)
            {
                ((LinkButton)(e.Row.Cells[7].FindControl("LinkButton3"))).Enabled = false;
            }
            else
            {
                ((LinkButton)(e.Row.Cells[7].FindControl("LinkButton3"))).Enabled = true;
            }
        }
    }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["zuoyeid"] == null)
     {
         Response.Redirect("zuoyeyuzhi.aspx");
     }
     else
     {
         zuoyeyibuzhi = !ZuoyeInfo.IsZuoyeUsed(Request.QueryString["zuoyeid"]);
     }
     if (!IsPostBack)
     {
         BindZuoyeTimu();
     }
 }