示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = CityDAO.GetDataCity();
                int       t  = dt.Rows.Count;
                cboFromCity.DataSource     = CityDAO.GetDataCity();
                cboFromCity.DataTextField  = "CityName";
                cboFromCity.DataValueField = "CityID";
                cboToCity.DataSource       = CityDAO.GetDataCity();
                cboToCity.DataTextField    = "CityName";
                cboToCity.DataValueField   = "CityID";
                cboFromCity.DataBind();
                cboToCity.DataBind();
            }

            if (Session["msg"] != null)
            {
                string msg = Session["msg"].ToString();
                lbNeedSearch.Text = msg;
                Session.Remove("msg");
            }
            else
            {
                lbNeedSearch.Text = "";
            }
        }
示例#2
0
        protected void ShowDataCity()
        {
            DataTable dt = CityDAO.GetDataCity();

            if (dt.Rows.Count > 0)
            {
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            else
            {
                dt.Rows.Add(dt.NewRow());
                GridView1.DataSource = dt;
                GridView1.DataBind();
                int columncount = GridView1.Rows[0].Cells.Count;
                GridView1.Rows[0].Cells.Clear();
                GridView1.Rows[0].Cells.Add(new TableCell());
                GridView1.Rows[0].Cells[0].ColumnSpan = columncount;
                GridView1.Rows[0].Cells[0].Text       = "No Records Found";
            }
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = CityDAO.GetDataCity();

                cbFromCity.DataSource     = dt;
                cbFromCity.DataValueField = "CityID";
                cbFromCity.DataTextField  = "CityName";
                cbFromCity.DataBind();

                cbToCity.DataSource     = dt;
                cbToCity.DataValueField = "CityID";
                cbToCity.DataTextField  = "CityName";
                cbToCity.DataBind();

                txtRoute.Text = cbFromCity.SelectedItem.ToString() + " to " + cbToCity.SelectedItem.ToString();
            }

            btnSave.Click += BtnSave_Click;
            btnBack.Click += BtnBack_Click;
            cbFromCity.SelectedIndexChanged += CbFromCity_SelectedIndexChanged;
            cbToCity.SelectedIndexChanged   += CbToCity_SelectedIndexChanged;
        }