Exemplo n.º 1
0
        protected void B1_Click(object sender, EventArgs e)
        {
            if (Text1.Text.ToString() == "")
            {
                MessageBox.Show("Lütfen Kargo Takip Kodunu Girin.");
            }

            else
            {
                try
                {
                    GridView1.Visible = true;
                    int id = bu1.Idvarmi(Convert.ToInt32(Text1.Text));
                    bu1.kapat();
                    bu1.ac();

                    SqlDataSource1.SelectCommand = "select KargoId,GondericiAdSad,SonDurum,AliciAdSad from Kargolar where KargoId=" + id + ";";
                    bu1.kapat();
                }
                catch (Exception)
                {
                    MessageBox.Show("Takip Kodunuzu Yanlış Girdiniz...");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Text1.BackColor     = System.Drawing.Color.White;
            Text2.BackColor     = System.Drawing.Color.White;
            Text3.BackColor     = System.Drawing.Color.White;
            Text4.BackColor     = System.Drawing.Color.White;
            Text5.BackColor     = System.Drawing.Color.White;
            Text6.BackColor     = System.Drawing.Color.White;
            GridView1.BackColor = System.Drawing.Color.White;


            if (!IsPostBack)
            {
                try
                {
                    b1.ac();
                    SqlCommand     bag         = new SqlCommand("Select id,sehir from Iller", b1.baglanti);
                    SqlDataAdapter DataAdapter = new SqlDataAdapter(bag);
                    DataSet        DataSet     = new DataSet();
                    DataAdapter.Fill(DataSet);
                    DD1.DataSource     = DataSet;//drop down lara illeri veritabanından çekiyoruz
                    DD3.DataSource     = DataSet;
                    DD1.DataTextField  = "sehir";
                    DD1.DataValueField = "id";
                    DD3.DataTextField  = "sehir";
                    DD3.DataValueField = "id";
                    DD1.DataBind();
                    DD3.DataBind();
                    DataSet.Clear();
                    b1.kapat();
                    lbltarih.Text = DateTime.Now.ToShortDateString();

                    //DD1.DataTextField = "SubeAdi";
                    //DD1.DataBind();
                    //DD1.Items.Insert(0, new ListItem("Seçiminiz...", "0"));
                    //DD1.SelectedIndex = 0;

                    //DD3.DataTextField = "SubeAdi";
                    //DD3.DataBind();
                    //DD3.Items.Insert(0, new ListItem("Seçiminiz...", "0"));
                    //DD3.SelectedIndex = 0;
                }
                catch (Exception)
                {
                }
            }
        }