0

我想在行更新时显示错误面板,但它不显示错误面板。这段代码有什么问题?

protected void Grades_GridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
{  
    string LetterGrade = Grades_GridView.DataKeys[e.RowIndex].Values["Letter_Grade"].ToString();
    TextBox txtMinGrade = (TextBox)Grades_GridView.Rows[e.RowIndex].FindControl("txtMinGrade");
    TextBox txtMaxGrade = (TextBox)Grades_GridView.Rows[e.RowIndex].FindControl("txtMaxGrade");

    if (Convert.ToDecimal(txtMinGrade.Text) > Convert.ToDecimal(txtMaxGrade.Text))
    {
        PanelError.Visible = true;
        LabelErrorString.Text = "Minimum grade must not be greater than maximum grade!";     
    }
    else
    {
        Admin.updateGradeRanges(LetterGrade, txtMinGrade.Text, txtMaxGrade.Text);
    }
    Grades_GridView.EditIndex = -1;
    FillGradeRangesInGrid();
}
4

0 回答 0