private void SelectionChanged(object sender, SelectionChangedEventArgs e) { if (AuthorSong.SelectedItem.ToString() == "Добавить нового автора") { AuthorName.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["ReferrerUrl"] = Request.UrlReferrer.ToString(); AuthorName.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string errorPage = "~/404"; ViewState["ReferrerUrl"] = Request.UrlReferrer.ToString(); if (Request.Params.AllKeys.Contains("id")) { int authorID = Convert.ToInt32(Request["id"]); var db = new BookLibrary.Models.BookLibraryContext(); Author author = db.Authors.First(a => a.AuthorID == authorID); AuthorName.Text = author.AuthorName; AuthorName.Focus(); } else { Response.Redirect(errorPage); } } }