How to bind the controls(best practice) comboboxes to the data in the dataset ?

Showing Answers 1 - 4 of 4 Answers

Sudhakar Leo

  • Oct 7th, 2005
 

I will give the cod e for itComboBox1.DataSorce = ds;ComboBox1.DataTextField = "ColumnNameOfTheTable";ComboBox1.DataBind();

  Was this answer useful?  Yes

Sathiyavathi

  • Mar 24th, 2006
 

Hi,

  I'll give an example for this :

   
            DataTable dt = new DataTable();
            OleDbConnection con = new OleDbConnection();
            OleDbCommand com = new OleDbCommand("Select * From Employees", con);
            OleDbDataAdapter da = new OleDbDataAdapter();
            da.SelectCommand = com;
            da.Fill(dt);
            DropDownList1.DataSource = dt;
            DropDownList1.DataBind();
 

  Was this answer useful?  Yes

Sanjar

  • May 22nd, 2006
 

The achive the best performance in databiding always use

 

Dim _Li as ListItem

While _Reader.Read()

  _Li=new ListItem(_Reader(1),_Reader(0))

  _dropdownList.Items.add(_Li)

End While

You can check with performance counter to check in real.

 

Cheers

Sanjar

niyazi.khan@gmail.com

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions