pria525

pria525

  • NA
  • 8
  • 0

Array of Checkboxes or Checkboxes in a PlaceHolder

Oct 5 2004 11:34 AM
Hi Folks, This is my first post here. If this is not the correct forum to post, do accept my apologies. I am working on creating checkboxes dynamically. I have a stored procedure that reads a list of interests from a table and these have to be displayed as checkboxes. I do this using a place holder and what I get is a series of checkboxes with column name next to them, but I want the values in that column and not column name. for(int i = 0; i < myDS.Tables["Interests"].Rows.Count; i++) { CheckBox objCheckBox = new CheckBox(); objCheckBox.ID = myDS.Tables["Interests"].Columns["InterestTypeID"].ToString(); objCheckBox.Text = myDS.Tables["Interests"].Columns["InterestType"].ToString(); phlInterests.Controls.Add(objCheckBox); } If I create an array of checkboxes, I keep running into an error Object reference not set to an instance of an object. Could someone point me in the right direction. Thanks, Priya

Answers (8)