I found a bug on my site and I can't seem to find a solution. I am dynamically generating controls, two of which are a RadDatePicker and a RadTimePicker. When different events occur on the page, I am changing the visibility of the controls between true and false after generating them (essentially based on whether the page is in 'edit' mode or view mode). However, after the first instance where the controls are visible, the controls lose their styles. Refer to the screenshot below:
If anyone has any suggestions, or advice, that'd be great. Thanks
Update: Here is the code as requested
This hides and shows controls(just change true/false)
for (int i = 0; i < customProperties.Rows.Count; i++)
{
customProperties.FindControl("CustomControl" + (i + 1).ToString()).Visible = false;
customProperties.FindControl("lblCustomControl" + (i + 1).ToString()).Visible = true;
Type aType = customProperties.FindControl("CustomControl" + (i + 1).ToString()).GetType();
if (aType.Name == "RadBinaryImage")
customProperties.FindControl("CustomControl" + (i + 1).ToString() + "_btn").Visible = false;
}
So basically it searches the htmltable (customProperties) for controls and changes the visibility
This is where the control is generated:
case DynamicFieldTypeEnum.Date:
RadDatePicker dp = new RadDatePicker();
dp = currentValues as RadDatePicker;
if (dp.SelectedDate == null)
customProperty.Text = "Not Specified";
else
customProperty.Text = dp.SelectedDate.Value.ToString(dp.DateInput.DateFormat);
dp.ID = "CustomControl" + (position + 1).ToString();
newControls[0] = customProperty;
newControls[1] = dp;
break;
case DynamicFieldTypeEnum.Time:
RadTimePicker tp = new RadTimePicker();
tp = currentValues as RadTimePicker;
if (tp.SelectedDate == null)
customProperty.Text = "Not Specified";
else
customProperty.Text = tp.SelectedDate.Value.ToString(tp.DateInput.DateFormat);
tp.ID = "CustomControl" + (position + 1).ToString();
newControls[0] = customProperty;
newControls[1] = tp;
break;
This is within a method that is given an object definition and then returns a control array. The first value in the control array is a label for "view" mode and the second control is a control for "edit" mode.
This array is then passed to a different method which places the controls within a table cell which is placed in a table row and then placed in the table "customProperties"