Hi all,

I am fairly new to C# and I am trying to fix a bug.

and I have no idea why this foreach is not working..

protected void CQList_ItemDataBound(Object sender, DataListItemEventArgs e)
{
Label questionNo = (Label)e.Item.FindControl("questionNo");
Label answerNo = (Label)e.Item.FindControl("answerNo");

DataGrid answerGrid = (DataGrid)e.Item.FindControl("answerGrid");

CustomQuestionCount++;
questionNo.Text = CustomQuestionCount.ToString();
answerNo.Text = questionNo.Text;

Dictionary<uint, string> answers = new Dictionary<uint, string>();
foreach (DataRow row in CustomQuestionDS.Tables[0].Select("question_id=" + ((KeyValuePair<uint, string>)e.Item.DataItem).Key))
{
answers[MLConvert.ToUInt32(row["answer_id"])] = (String)row["answer"];
}


answerGrid.DataSource = answers;
answerGrid.DataBind();
}

It returns the data twice but with different IDs...weird, figured maybe someone can point me in the right direction and ect.