This is a migrated thread and some comments may be shown as answers.

[Solved] RadComboBox inside a Repeater or PlaceHolder which is inside a FormView

2 Answers 176 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Sima Ganji
Top achievements
Rank 1
Sima Ganji asked on 21 Jul 2009, 09:27 PM

Hi,

I have a Repeater inside a FormView in my page.I am creating a RadComboBox control programmatically and adding it to the Repeater.

protected

 

void DynamicFieldsRepeater_PreRender(object sender, EventArgs e)

 

{

      Repeater

 

repeater = (Repeater)sender;

 

      RadComboBox

 

comboBox = new RadComboBox();

 

      comboBox.ID =

"combo";

 

      comboBox.DataSourceID =

"ObjectDataSource2";

 

 

 

      comboBox.DataTextField =

"Name";

 

 

 

      comboBox.DataValueField =

"Id";

 

 

 

      repeater.Controls.Add(comboBox);

 

 

    //DropDownList d = new DropDownList();

 

 

    //d.ID = "dropdown";

 

    //d.DataSourceID =

"ObjectDataSource2";
    //d.DataTextField = "Name";
    //d.DataValueField = "Id";

 

 

 

   // repeater.Controls.Add(dropdown);

 

 

 

}

When I run the page I get this java script error:
'addEventListener' is null on not an object.

The thing is when I use DropDownList instead of RadComboBox,it works fine without error.
I am able to add RadDatePicker,RadTextBox,RadNumerticTextBox without the error, but not RadComboBox.
I am facing the same error when I use PlaceHolder instead of Repeater and try to add RadComboBox to to the placeholder programmatically.
Just to mention that I tried adding the controls in IntemCreated event of the repeater and the same error happend.

Thanks for your help.
Sima 

2 Answers, 1 is accepted

Sort by
0
Sima Ganji
Top achievements
Rank 1
answered on 22 Jul 2009, 01:49 PM
Just to add that I am getting the same error when adding a RadComboBox to a Panel inside a FormView dynamically. 
0
Sima Ganji
Top achievements
Rank 1
answered on 22 Jul 2009, 10:38 PM
I figured it out for repeater control:

protected

 

void DynamicFieldsRepeater_ItemCreated(Object Sender, RepeaterItemEventArgs e)

 

{

   RadComboBox

 

comboBox = new RadComboBox();

 

   PlaceHolder

 

p1 = (PlaceHolder)e.Item.FindControl("p1");

 

   p1.Controls.Add(comboBox);

}
Thanks,
sima
Tags
ComboBox
Asked by
Sima Ganji
Top achievements
Rank 1
Answers by
Sima Ganji
Top achievements
Rank 1
Share this question
or