rra

rra

  • NA
  • 2
  • 0

DataList doesn't display

Oct 3 2003 10:25 AM
I am trying to display a simple datalist and datagrid on a webform, the datagrid display properly but the datalist doesn’t. I tried to get the datalist only but still it doesn’t work. I don’t get any error message/Exception. My code: private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here string sql = "SELECT * FROM aEvents"; SqlConnection m_SqlConnection = new SqlConnection(CDb.DsnEvents); SqlCommand myCommand = new SqlCommand(sql,m_SqlConnection); SqlDataReader myDataReader; try { m_SqlConnection.Open(); myDataReader = myCommand.ExecuteReader(); DataList1.DataSource = myDataReader; DataGrid1.DataSource = myDataReader; DataGrid1.DataBind(); DataList1.DataBind(); m_SqlConnection.Close(); } catch (Exception myException) { Response.Write("An error has occurred: " + myException.ToString()); } }

Answers (1)