I am adding some controls dynamically to a Repeater which is inside a FormView.
protected
void DynamicRepeater_ItemCreated(Object sender, RepeaterItemEventArgs e)
{
IDictionary
<string, string> values = RetrieveValues();
RadComboBox combo= new RadComboBox();
//DropDownList combo= new DropDownList();
combo.ID =
"SomeId";
combo.DataSource = values;
combo.DataValueField =
"Key";
combo.DataTextField =
"Value";
e.Item.Controls.Add(combo)
}
There is another RadComboBox control named TypeComboBox with AutoPostBack="true" inside the FormView.
Whenever the TypeComboBox selection changes, the repeater needs to be rebound and the dynamic controls will be recreated inside the repeater.
So I added the following code to ajaxify the repeater:
protected void Page_PreRender(object sender, EventArgs e)
{
RadComboBox
typeComboBox = (RadComboBox)FormView1.FindControl("TypeComboBox ");
RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(typeComboBox , (Repeater)FormView1.FindControl("DynamicRepeater"));
}
This does not work.The point is when I replace the RadComboBox with an Asp DropDownList ,the ajax works fine.So I assume the problem might be happening by the RadComboBox.
Note that Ajaxifying the whole FormView is not an option for me, because I don't want to lose the data that user entered in the other controls in the FormView after selecting the Type.
I had a previous issue with the ajaxifying other controls like Panel and PlaceHolder inside a FormView(Support ID:228263 -- Problem with RadAjaxManager and Panel or PlaceHolder inside a FormView), but I am afraid the answer was not very saticefying because like I explained the whole FormView shouldn't be refreshed in my case.
What can I do to solve this issue?
Thanks in advance for your help.
Sima