Wednesday, March 21, 2012

Composite Control and CalendarExtender error

I'm trying to create a server control that wraps up a TextBox, calendar Image, and a AJAX 1.0 CalendarExtender. Here is a section of the code:

protected override void CreateChildControls() {txtDate.Width = 75;Controls.Add(txtDate);imgCal.ImageUrl= _iconURL;imgCal.ImageAlign= ImageAlign.AbsMiddle;Controls.Add(imgCal);calEx.PopupButtonID= imgCal.UniqueID;calEx.TargetControlID= txtDate.UniqueID;Controls.Add(calEx);}

Here is the runtime error I am getting:

"'_behaviors' is null or not an object"

Any ideas?

Looks like there is a little information about adding the behaviors here:

http://forums.asp.net/thread/1293293.aspx#13

But this leeds me to believe I need a client script on every page I plan to have this control. Which isn't really acceptable.

Is there a way to wrap it up in one compiled control?


Did you have any luck doing this? I'm in the process of doing the exact same thing.

Also, I'm having problems finding the Calendar Extender control to dynamically add it. I'm sure I'm missing something. I've tried adding references to the AjaxControlToolkit and the AJAXExtensionsToolbox, but no luck in finding it. I do see the AjaxControlToolkit namespace and several controls under it, just no Calendar.

Thanks In Advance!


Firgured out the problem... somehow the older version of the AjaxControlTool.dll got in there.

I got it working great!

No comments:

Post a Comment