protected void btnSubmit_Click(object sender, EventArgs e) { string imagefile = "notavailable.jpg"; if (FileUpload1.HasFile) //checking whether the file upload has the file { imagefile = FileUpload1.FileName; FileUpload1.SaveAs(Server.MapPath("~/images/" + imagefile));//store the file in the images folder } Hotel h = (Hotel)Session["userHotel"]; //retrieve the hotel session Random rnd = new Random(); //declara random number generator int rId = rnd.Next(0, 100); //initialize the random number generator Room r = new Room() { RoomID = "RM" + rId, RoomName = tbxName.Text, Type = tbxType.Text, Capacity = Convert.ToInt32(tbxCap.Text), RoomSize = tbxSize.Text, Desc = tbxDesc.Text, Remarks = tbxRemarks.Text, Services = tbxServices.Text, Pictures = imagefile, Price = Convert.ToDouble(tbxPrice.Text), Hotel = h }; int id = RoomDB.insertRoom(r); //to insert room into database lblOutput.Text = "Successfully added!"; //to show the message, where hotel owner successfully added room into database tbxName.Text = ""; tbxType.Text = ""; tbxCap.Text = ""; tbxSize.Text = ""; tbxDesc.Text = ""; tbxRemarks.Text = ""; tbxServices.Text = ""; imagefile = "notavailable"; tbxPrice.Text = ""; gvBind(); }