Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
I have created a number of classes that generate a variety of controls dynamically. Two of the controls are the date and mask edit control. I use the EO controls for these. They work great except for one thing. When those controls are present on a page, no other controls can post back. I have set break points in the debugger and everything post's back just fine, until I add an EO control. I can provide more information, but I am assuming that I am not the only person who has come across this anomaly. I assume there is some setting in the EO controls that is causing this. I did drop out the EO script manager because the controls are being created in OnInit function and are wrapped by an ajax update panel. Any help would be greatly appreciated. Below is some code for the masked edit (time control):
// *** Build the time control from a multi segment masked edit me = new MaskedEdit(); me.ID = base.id; me.CssClass = base.ctrl_cssclass;
// *** Hour EO.Web.MaskedEditSegment ms; ms = new MaskedEditSegment(); ms.IsRequired = true; ms.MaxValue = 12; ms.SegmentType = EO.Web.MaskedEditSegmentType.Number; me.Segments.Add(ms);
// *** Colon ms = new MaskedEditSegment(); ms.IsRequired = true; ms.Text=":"; me.Segments.Add(ms);
// *** Minute ms = new MaskedEditSegment(); ms.IsRequired = true; ms.MaxValue = 59; ms.SegmentType = EO.Web.MaskedEditSegmentType.Number; me.Segments.Add(ms);
// *** Space ms = new MaskedEditSegment(); ms.IsRequired = true; ms.Text = " "; me.Segments.Add(ms);
// *** Am/Pm ms = new MaskedEditSegment(); ms.IsRequired = true; ms.Choices = "AM|PM"; ms.SegmentType = MaskedEditSegmentType.Choice; me.Segments.Add(ms);
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
It does not make any difference to the control as to whether you are dynamically creating them or not. The only difference between a statically declared control and a dynamically created control is if you declare them statically in .aspx file, ASP.NET compiler generates the code based on your .aspx file, that code then dynamically creates the control. So the only difference is whether the controls are dynamically created by ASP.NET compiler generated code or by your code. Obviously there is no difference between the two from the control point of view.
Thus I would suggest you to try placing the control statically first. If that does not cause problem, then the problem is in your code. There are a number of rules that you have to follow while creating control dynamically, but all are general rules that applies whenever you create any control dynamically. One of the most important rule is you need to recreate exactly the same control at the same position when the page posts back (thus the control tree during the post back will be exactly the same as that of the initial page). So you might want to check that first.
If the problem persists, you can try to isolate the problem into a test page and we will be happy to take a look. Make sure your test page runs independently and only contains code needed to reproduce the problem.
Thanks
|
Rank: Advanced Member Groups: Member
Joined: 12/19/2010 Posts: 47
|
Assuming that it was not the fault of the EO control, I removed the Ajax Update Panel. This usually gives more error information. Sure enough, it was my own boneheaded mistake. I named the control with the same ID as the asp panel that holds the dynamic control. Removing the update panel spit the error at me immediately. I apologize for wasting your time.
|