I am new to Telerik controls. I am attempting to bind data to a rad grid using the NeedDataSource event. I am using a MySql database.
My current C# code is.
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
long ll_error;
CommandType CommandType = CommandType.Text;
dbConn = System.Configuration.ConfigurationManager.AppSettings["MYSQLDBConn"].ToString();
MySqlConnection connection = new MySqlConnection(dbConn);
connection.Open();
MySqlCommand command = new MySqlCommand("SELECT * FROM syslookup;", connection);
command.CommandType = CommandType;
MySqlDataAdapter _DataAdapter = new MySqlDataAdapter();
_DataAdapter.SelectCommand = command;
DataTable myDataTable = new DataTable();
ll_error = _DataAdapter.Fill(myDataTable);
RadGrid1.DataSource = myDataTable;
}
In the debugger I can see that the datasource has rows in it, but the grid will not show anything. It just says no records to display. Is there something I am missing or some property that needs to be set that I do not know about. Thanks.
My current C# code is.
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
long ll_error;
CommandType CommandType = CommandType.Text;
dbConn = System.Configuration.ConfigurationManager.AppSettings["MYSQLDBConn"].ToString();
MySqlConnection connection = new MySqlConnection(dbConn);
connection.Open();
MySqlCommand command = new MySqlCommand("SELECT * FROM syslookup;", connection);
command.CommandType = CommandType;
MySqlDataAdapter _DataAdapter = new MySqlDataAdapter();
_DataAdapter.SelectCommand = command;
DataTable myDataTable = new DataTable();
ll_error = _DataAdapter.Fill(myDataTable);
RadGrid1.DataSource = myDataTable;
}
In the debugger I can see that the datasource has rows in it, but the grid will not show anything. It just says no records to display. Is there something I am missing or some property that needs to be set that I do not know about. Thanks.