Welcome Guest Search | Active Topics | Sign In | Register

Dynamically added 'onclient' actions not executing Options
PMB Tech
Posted: Monday, August 25, 2008 12:39:47 PM
Rank: Newbie
Groups: Member

Joined: 8/25/2008
Posts: 4
If I hardcode ClientSideOnChange="UpdateText1FontColor" in the markup, the call is made and everything works just fine.

When I make it dynamic and add attributes in page_load such as:
pickFontColor.Attributes.Add("ClientSideOnChange", "Update" & FontColorTarget & "FontColor"
The call is not made part of the control when rendered. I did a search on the source and the call was not there, but it is when hardcoded.

The colorpicker is in a UserControl called "TextData" that is embeded in another UserControl called "DisplayText". The "DisplayText" control is sitting on a webform inside a tab. The "Attributes.Add" code is in the page_load of the "TextData" usercontrol directly housing the colorpicker. The value "FontColorTarget" is a public property on the "TextData" usercontrol.

I put a beakpoint in the page_load and the correct value is there and the "Attributes.Add" method ececutes w/o error.

Any Ideas?
Mike
eo_support
Posted: Monday, August 25, 2008 1:01:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,098
Hi Mike,

ClientSideOnChange is a server side property and it does not directly map to any client side DHTML attribute. So you won't be able to do it that way. I am a little bit confused about your UserControl structure, but if pickFontColor is the color picker, you would simply do:

pickFontColor.ClientSideOnChange = "Update" & FontColorTarget & "FontColor"

If the pickFontColor is the user control, you can put similar code inside the user control's Page_Load. The key is, you use colorPicker.ClientSideOnChange = "something" instead of colorPicker.Attributes.Add("ClientSideOnChange", "something).

Please feel free to let us know if you still need any more help.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.