public void LoadAllBooks() { BookBLL aBookBll = new BookBLL(); allBooksDropDownList.DataSource = aBookBll.GetAllBooks(); allBooksDropDownList.DataTextField = "Title"; allBooksDropDownList.DataValueField = "Id"; allBooksDropDownList.DataBind(); }
public void LoadAllBooks() { BookBLL aBookBll = new BookBLL(); allBooksDropDownList.Items.Insert(0, new ListItem("Select a book", "0")); allBooksDropDownList.DataSource = aBookBll.GetAllBooks(); allBooksDropDownList.DataTextField = "Title"; allBooksDropDownList.DataValueField = "Id"; allBooksDropDownList.DataBind(); }
protected void allBooksDropDownList_SelectedIndexChanged(object sender, EventArgs e) { Book aBook = new Book(); BookBLL aBookBll = new BookBLL(); int index = allBooksDropDownList.SelectedIndex; aBook = aBookBll.GetAllBooks()[index]; ViewState["bookId"] = aBook.Id; authorTextBox.Text = aBook.Author; publisherTextBox.Text = aBook.Publisher; }
private void update_Click(object sender, RoutedEventArgs e) { BookWindow1 BookWindow = new BookWindow1(); BookWindow.WindowStartupLocation = WindowStartupLocation.Manual; BookWindow.Left = this.Left; BookWindow.Top = this.Top; BookWindow.Show(); BookBLL book = new BookBLL(); BookWindow.dataGrid.ItemsSource = book.GetAllBooks(); this.Close(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <Book> books = aBookBll.GetAllBooks(); books.Insert(0, new Book() { BookId = -99, BookTitle = "Selected Book" }); titleDropDownList.DataSource = books; titleDropDownList.DataTextField = "BookTitle"; titleDropDownList.DataValueField = "BookId"; titleDropDownList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { aBook = new Book(); List<Book> books = books = aBookBll.GetAllBooks(); selectBookDropDownList.DataTextField = "Title"; selectBookDropDownList.DataValueField = "Id"; selectBookDropDownList.DataSource = books; selectBookDropDownList.DataBind(); } }