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

Adding RadCombo to Calendar Dayrender events results in Null Page

2 Answers 46 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 14 Jul 2008, 10:19 PM
If I build a RadComboBox and add it to my day I get a null page error, however if I use standard asp.net dropdownlist it works fine....

Commented code fails...

       protected void Page_Load(object sender, EventArgs e)  
        {  
            RadCalendar1.SelectedDate = DateTime.Now;  
            this.RadCalendar1.DayRender += new Telerik.Web.UI.Calendar.DayRenderEventHandler(RadCalendar1_DayRender);  
 
        }  
 
        private void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)  
        {  
             
   
            //RadComboBox rdcbo = new RadComboBox();  
            //rdcbo.ID = "bah" + e.Day.Date.ToShortDateString();  
            //RadComboBoxItem radcboitem = new RadComboBoxItem();  
            //radcboitem.Text = "Joe Schmo";  
            //radcboitem.Value = "0" + "|" + "12345" + "|" + "54321";  
            //rdcbo.Items.Add(radcboitem);  
            //e.Cell.Controls.Add(rdcbo);  
            DropDownList ddl1 = new DropDownList();  
            ddl1.ID = "bah" + e.Day.Date.ToShortDateString();  
            ListItem li1 = new ListItem();  
            li1.Text = "Joe Schmo";  
            li1.Value = "0" + "|" + "12345" + "|" + "54321";  
            ddl1.Items.Add(li1);  
            e.Cell.Controls.Add(ddl1);  
              
              
        }  
 

Any ideas?

2 Answers, 1 is accepted

Sort by
0
Ryan
Top achievements
Rank 1
answered on 17 Jul 2008, 03:52 AM
Anyone?
0
plamen
Top achievements
Rank 1
answered on 18 Jul 2008, 11:34 AM
hi:)

Because the DayRender event is raised while the RadCalendar control is being rendered, you cannot add a ScriptControl like RadComboBox. You can only add static controls, such as System.Web.UI..::.LiteralControl, Label, Image, and HyperLink.



Thank you...
<John:Peel />
Tags
ComboBox
Asked by
Ryan
Top achievements
Rank 1
Answers by
Ryan
Top achievements
Rank 1
plamen
Top achievements
Rank 1
Share this question
or