protected void AddGroup() { var studentGroup = new StudentGroup(NameTextBox.Text); studentGroup.Id = _groupAccessor.Insert(studentGroup); _studentGroups.Add(studentGroup); NameTextBox.Text = ""; GridView1.SelectedIndex = -1; GridView1.DataBind(); }
protected void AddGroup(object sender, EventArgs e) { if (TextBox1.Text == "") { ErrorLabel.Text = "Не задано название группы"; return; } if(TextBox1.Text.Length > 10) { ErrorLabel.Text = "Название группы не должно превышать 10 символов"; return; } ErrorLabel.Text = ""; var studentGroup = new StudentGroup(TextBox1.Text); _studentGroups.Add(studentGroup); _groupAccessor.Insert(studentGroup); TextBox1.Text = ""; GridView1.DataBind(); }