示例#1
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedItem.ToString() == "")
            {
                Automobil auto = new Automobil();
                DataTable dt   = auto.DohvatiAutomobile();

                dt.Columns[1].ColumnName = "Marka";
                dt.Columns[2].ColumnName = "Model";
                dt.Columns[3].ColumnName = "Tip";

                AutiGrid.DataSource = dt;

                AutiGrid.Columns[0].Visible = false;
                AutiGrid.Columns[4].Visible = false;

                AutiGrid.Columns[1].Width = 170;
                AutiGrid.Columns[2].Width = 170;
                AutiGrid.Columns[3].Width = 170;
            }
            else
            {
                Automobil auto = new Automobil();
                DataTable dt   = auto.DohvatiAutomobilPremaMarki(comboBox1.SelectedValue.ToString());



                AutiGrid.DataSource = dt;

                AutiGrid.Columns[0].Visible = false;

                AutiGrid.Columns[4].Visible = false;
                AutiGrid.Columns[5].Visible = false;
                AutiGrid.Columns[6].Visible = false;
                AutiGrid.Columns[7].Visible = false;
                AutiGrid.Columns[8].Visible = false;
            }
        }