protected void SubmitButton_Click(object sender, EventArgs e)
    {
        da = new SqlDataAdapter("insert into [Homestay-Resort_Details](HR_Type,HR_Stars,HR_Category,HR_Name,HR_Country,HR_City,Amount,Description)values('" + DropDownListType.SelectedItem.Text + "','" + NameDropDownList.SelectedItem.Text + "','" + DropdownCategory.SelectedItem.Text + "','" + NameTextBox.Text + "','" + DropDownCountry.SelectedItem.Text + "','" + DropDownCity.SelectedItem.Text + "'," + TextBoxAmount.Text + ",'" + DescTextBox.Text + "')", con);
        dt = new DataTable();
        da.Fill(dt);
        CmtLabel.Text = "Data Submit";
        DropDownListType.ClearSelection();
        NameDropDownList.ClearSelection();
        DropdownCategory.ClearSelection();
        NameTextBox.Text = "";
        DropDownCountry.ClearSelection();
        DropDownCity.ClearSelection();
        TextBoxAmount.Text = "";
        DescTextBox.Text   = "";
        CmtLabel.Text      = "Data Submit";


        da = new SqlDataAdapter("select * from [Homestay-Resort_Details] order by HR_ID desc", con);
        dt = new DataTable();
        da.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            GridViewHomestayDetails.DataSource = dt;
            GridViewHomestayDetails.DataBind();
        }
        else
        {
            GridViewHomestayDetails.DataSource = "";
            GridViewHomestayDetails.DataBind();
        }
    }
 protected void GridViewHomestayDetails_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridViewHomestayDetails.PageIndex = e.NewPageIndex;
     da = new SqlDataAdapter("select * from [Homestay-Resort_Details] order by HR_ID desc", con);
     dt = new DataTable();
     da.Fill(dt);
     if (dt.Rows.Count > 0)
     {
         GridViewHomestayDetails.DataSource = dt;
         GridViewHomestayDetails.DataBind();
     }
     else
     {
         GridViewHomestayDetails.DataSource = "";
         GridViewHomestayDetails.DataBind();
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        con = new SqlConnection(ConfigurationManager.AppSettings["con"]);
        if (Page.IsPostBack == false)
        {
            da = new SqlDataAdapter("select * from [Homestay-Resort_Details] order by HR_ID desc", con);
            dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                GridViewHomestayDetails.DataSource = dt;
                GridViewHomestayDetails.DataBind();
            }
            else
            {
                GridViewHomestayDetails.DataSource = "";
                GridViewHomestayDetails.DataBind();
            }
        }
        if (Page.IsPostBack == false)
        {
            da = new SqlDataAdapter("select distinct CountryName from CountryCityMaster order by CountryName", con);
            dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                DropDownCountry.DataSource    = dt;
                DropDownCountry.DataTextField = "CountryName";
                DropDownCountry.DataBind();

                DropDownCountry.Items.Insert(0, "Select Country");
                DropDownCountry.Items.Insert(dt.Rows.Count + 1, "Other Country");
            }
        }
        if (Page.IsPostBack == false)
        {
            da = new SqlDataAdapter("select  HomestayResortCotegory from  HomestayResortCategory", con);
            dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                DropdownCategory.DataSource    = dt;
                DropdownCategory.DataTextField = "HomestayResortCotegory";
                DropdownCategory.DataBind();

                DropdownCategory.Items.Insert(0, "Select Homestay and Resort");
                DropdownCategory.Items.Insert(dt.Rows.Count + 1, "Other Homestay and Resort");
            }
        }
        if (Request.QueryString["P"] == "AMP")
        {
            hiderow1.Visible                = true;
            hiderow2.Visible                = true;
            hiderow3.Visible                = true;
            hiderow4.Visible                = true;
            hiderow6.Visible                = false;
            SubmitButton.Visible            = true;
            Button1.Visible                 = false;
            titleLabel.Text                 = "Insert HomeStay and Resort Detail";
            GridViewHomestayDetails.Visible = true;
        }
        else if (Request.QueryString["P"] == "UMP")
        {
            hiderow1.Visible                = false;
            hiderow2.Visible                = false;
            hiderow3.Visible                = false;
            hiderow4.Visible                = false;
            hiderow6.Visible                = true;
            SubmitButton.Visible            = false;
            Button1.Visible                 = true;
            titleLabel.Text                 = "Search HomeStay and Resort";
            GridViewHomestayDetails.Visible = false;
        }
        else
        {
            hiderow1.Visible                = false;
            hiderow2.Visible                = false;
            hiderow3.Visible                = false;
            hiderow4.Visible                = false;
            hiderow6.Visible                = true;
            SubmitButton.Visible            = false;
            Button1.Visible                 = true;
            titleLabel.Text                 = "Search HomeStay and Resort";
            GridViewHomestayDetails.Visible = false;
        }
    }