예제 #1
0
 protected void GridViewAuthors_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridViewAuthors.PageIndex     = e.NewPageIndex;
     GridViewAuthors.SelectedIndex = -1;
     PanelPublications.Visible     = false;
     PanelEdit.Visible             = false;
     GridViewAuthors.DataSource    = PublicationsDAL.AuthorsAll;
     GridViewAuthors.DataBind();
 }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     GridViewAuthors.PageSize = int.Parse(DDListNumberResults.SelectedValue);
     if (!IsPostBack) //only at the beginning
     {
         PublicationsDAL.AuthorsAll = PublicationsDAL.GetAuthors();
     }
     GridViewAuthors.DataSource = PublicationsDAL.AuthorsAll;
     GridViewAuthors.DataBind();
     PanelChangeName.Visible = false;
 }
예제 #3
0
 protected void ButtonSave_Click(object sender, EventArgs e)
 {
     if (selectedAuthor.Id != 0 && TextBoxName.Text != selectedAuthor.Autor) //if something has changed
     {
         PublicationsDAL.UpdateAuthor(selectedAuthor.Id, TextBoxName.Text);
         //update view
         GridViewAuthors.DataSource = PublicationsDAL.AuthorsAll = PublicationsDAL.GetAuthors();
         GridViewAuthors.DataBind();
         foreach (var author in PublicationsDAL.AuthorsAll)
         {
             if (author.Id == (int)GridViewAuthors.SelectedValue)
             {
                 selectedAuthor = new Author(author.Id, author.Autor);
                 ShowPublications(selectedAuthor);
                 break;
             }
         }
         Response.Write("<script>alert('Imię i nazwisko autora zaktualizowane')</script>");
     }
 }