Showing posts with label image. Show all posts
Showing posts with label image. Show all posts

Monday, March 26, 2012

Connect AnimationExtender at runtime

Hi,

I have created a page with a datalist that has a button and a image inside the itemtemplate. So what I trying to do is to connect the animationextender with the button (targetid) at runtime, wich does not work at all. Is it possible to connect (set target id) at runtime or must it be done in designtime?

//CC

Hi TCNC,

The Animation Framework has a n undocumented feature wherein any attribute assigned to the AnimationExtender is evaluated at runtime .

You can use it by suffixing the Attribute with the Attribute "Script"

EX: < ajaxToolkit:AnimationExtender Blah>

<OnClick>

<Resize Height="200" width="200" AnimationTargetScript="getTargetElement();" />

</OnClick>

</ajaxToolkit:AnimationExtender>

<script language="Javascript">

function getTargetElement(){

return someelementID;

}

</script>

This will cause the function getTargetElement to be called whenever the Animation is played.

You can probably set the ID of the Element to be animated in a hidden field.

In the Function "getTargetElement" read the HiddenField and return its value.

When the Animation plays , the target is automatically changed.

Hope this helps.

And if it resolves the issue , Please mark my reply as the answer

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!