Error:
'addEventListner' is null or not an object
inside onload method:
panel.ID =
"Panel1";
this.Controls.Add(panel);
RadComboBox cbxName =
new RadComboBox();
cbxName.ID =
"cbxName";
cbxName.ItemsRequested +=
new RadComboBoxItemsRequestedEventHandler(cbxName_ItemsRequested);
cbxName.Skin = Skin;
panel.Controls.Add(cbxName);
RadAjaxManager
ajaxManager = RadAjaxManager.GetCurrent(this.Page);
if (ajaxManager == null)
{
ajaxManager =
new RadAjaxManager();
ajaxManager.ID =
"RadAjaxManager1";
Controls.Add(ajaxManager);
this.Page.Items.Add(typeof(RadAjaxManager), ajaxManager);
}
ajaxManager.AjaxSettings.AddAjaxSetting(cbxName, panel);
private
DataTable GetData(string text, string connString)
{
using (SqlConnection conn = new SqlConnection(connectionString))
{
conn.Open();
using (SqlCommand command = new SqlCommand("mystoredproc", conn))
{
command.CommandType =
CommandType.StoredProcedure;
command.Parameters.Add(
new SqlParameter("@paramName", text));
SqlDataAdapter adapter = new SqlDataAdapter(command);
DataTable data = new DataTable();
adapter.Fill(data);
return data;
}
}
}
protected
void cbxName_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
try
{
int itemsPerRequest = 10;
if (e.Text.Length >= 3)
{
DataTable table = GetData(e.Text, connectionString);
int itemOffset = e.NumberOfItems;
int endOffset = Math.Min(itemOffset + itemsPerRequest, table.Rows.Count);
e.EndOfItems = endOffset == table.Rows.Count;
for (int i = itemOffset; i < endOffset; i++)
{
cbxName.Items.Add(
new RadComboBoxItem(table.Rows[i]["Name"].ToString(), table.Rows[i]["ID"].ToString()));
}
}
else
{
cbxName.Items.Clear();
}
}
catch (Exception ex)
{
throw ex;
}
}