I use a prometheus combobox. I use header and item templates. I have set EnableLoadOnDemand = true. I use the ItemsRequested eventhandler.
The control is on the page initially, but in a hidden panel (so not rendered). After a postback the panel is visible. This combox control looks ok, but the dropdown does not work at all.
The dropdown does work if the control is initaly rendered.
Is there any work around to this situation, such as registering javascript during the ajax callback?
protected
void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void Page_PreRender(object sender, EventArgs e)
{
this.BuildGrid();
}
protected void Page_Init(object source, System.EventArgs e)
{
}
private void BuildGrid()
{
GridBoundColumn boundColumn;
boundColumn = new GridBoundColumn();
boundColumn.DataField = "CountryId";
boundColumn.HeaderText = "Country Number";
this.RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn = new GridBoundColumn();
boundColumn.DataField = "CountryName";
boundColumn.HeaderText = "Country Name";
this.RadGrid1.MasterTableView.Columns.Add(boundColumn);
RadGrid1.Width = Unit.Percentage(50);
RadGrid1.PageSize = 50;
RadGrid1.AllowPaging = true;
RadGrid1.PagerStyle.Mode = Telerik.Web.UI.GridPagerMode.NextPrevNumericAndAdvanced;
RadGrid1.AutoGenerateColumns = false;
RadGrid1.ShowStatusBar = true;
RadGrid1.Skin = "Web20";
RadGrid1.ShowStatusBar = true;
RadGrid1.GridLines = GridLines.Horizontal;
RadGrid1.HorizontalAlign = HorizontalAlign.Left;
RadGrid1.ShowFooter = true;
RadGrid1.ShowHeader = true;
RadGrid1.ShowStatusBar = true;
RadGrid1.AllowSorting = true;
RadGrid1.Visible = true;
this.RadGrid1.DataSource = this.GetData();
this.RadGrid1.DataBind();
}
private DataSet GetData()
{
SqlConnection sqlConnection = new SqlConnection();
SqlCommand sqlCommand = new SqlCommand();
SqlParameter sqlParameter = new SqlParameter();
DataSet dataSet = new DataSet();
try
{
if (sqlConnection.State != ConnectionState.Open)
{
sqlConnection.ConnectionString = SqlConnectionString.GetConnectionString();
sqlConnection.Open();
}
sqlCommand.Connection = sqlConnection;
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.CommandText = ApplicationStoredProcedures.GetCountries();
sqlCommand.Parameters.Add("@WebPageName", SqlDbType.NVarChar).Value = "Authors.aspx";
sqlCommand.Parameters.Add("@CultureCode", SqlDbType.NVarChar).Value = "en-US";
sqlCommand.Parameters.Add("@ControlName", SqlDbType.NVarChar).Value = "ddlCountry";
sqlCommand.ExecuteNonQuery();
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
sqlDataAdapter.Fill(dataSet);
return dataSet;
}
catch (SqlException sql)
{
throw sql;
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (sqlConnection.State != ConnectionState.Closed)
{
sqlConnection.Close();
}
sqlCommand.Dispose();
}
}
public void RadGrid1_PageIndexChanged(object source, Telerik.Web.UI.GridPageChangedEventArgs e)
{
this.RadGrid1.CurrentPageIndex = e.NewPageIndex;
}
/// <summary>
/// You can get the exact numbers of rows in your RadGrid either directly from the DataSource or in the following manner in the ItemDataBound event:
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridPagerItem)
{
Label1.Text = (e.Item as GridPagerItem).Paging.DataSourceCount.ToString();
}
}
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
// RadGrid1.DataSource = this.GetData() ;
}
I cannot find the issue. Am I doing something wrong.