Vlad Jichici

Vlad Jichici

  • 1.6k
  • 88
  • 1.2k

Listbox in asp.net is not displaying the added items .

Mar 20 2018 11:27 AM
public partial class Default : System.Web.UI.Page
{
private List<ClientReservationRoom> lista = new List<ClientReservationRoom>();
private List<RoomCheckout> room_checkout = new List<RoomCheckout>();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lnkpickdate_Click(object sender, EventArgs e)
{
datepicker.Visible = true;
txtdtp.Text = datepicker.SelectedDate.ToShortDateString();
}
protected void datepicker_SelectionChanged(object sender, EventArgs e)
{
txtdtp.Text = datepicker.SelectedDate.ToShortDateString();
datepicker.Visible = true;
}
protected void btnAddCustomer_Click(object sender, EventArgs e)
{
string name;
decimal number;
string type;
name = txtName.Text;
number = Convert.ToDecimal(txtPhone.Text);
type = cmbType.Text;
ClientReservationRoom clientreservation = new ClientReservationRoom(name, number, type);
lista.Add(clientreservation);
}
protected void btnListCustomers_Click(object sender, EventArgs e)
{
lbReservations.Items.Clear();
foreach (ClientReservationRoom reservationroom in lista)
lbReservations.Items.Add(reservationroom.DisplayName());
}
}

Answers (3)