Showing posts with label behaviour. Show all posts
Showing posts with label behaviour. Show all posts

Wednesday, March 21, 2012

Event issue ?

Hi everybody,

I have a real weird behaviour on a control with Ajax (seems to be the cause) :

I have a UserControl, developped without taking care of Ajax thing. It works fine when placed in a basic Page, but it does not work at all when integrated in the global application we are developping.

There are some combos in my control, selecting an item in the first one set the values of the two other and add some controls in the page. Selecting an item on the two other applies a filter on the possible values of the first one and unselect (and remove additionnal controls). So i have a postback event launched on each combo selection changed.

The difference between the two contexts is mostly that control is dynamically loaded in a PlaceHolder (placed in a UpdatePannel) during CreateChildControls step in the application.

The issue is that in the application, the UserControl initializes fine, but here is what happens next :

1 - I select a value in the first DDL : it works fine.

2 - I select another value, no matter what DDL : It fires multiple events, and sometimes not the one which rised the postback. So my control have an heratic behaviour.

Any idea for the reason ?

Thanks for your help.

It sounds very strange to trigger multiply events at the same time.Try to specify asynchronous?post?back?for?the?DropDownLists?in?a?asp:UpdatePanel.
If you place a user control in a asp:UpdatePanel in a web form,try to set the postback ControlID = User control ID.
If you still have any question about multiply triggered events of the DropDownlists,try to post some codes. I'd like to check it.

Event handlers for behaviors using the extenders

Hi

Is there a way to set the handler for an event of a behaviour (i.e. expandedCompleted for CollapsiblePanel) using the extender and the extender properties?
In this case, the behavior has the event, but in the CollapsiblePanelProperties only the properties are available.

Thank you
Vlad

Unfortunately, this doesn't work because the events on the behavior are client side, and any event hookups done via the ASPX are server-side.

To hook up to those events, you'll need to it from Javascript, which is possible. I think you can set an ID property in your properties declaration and then access that object at runtime with "$object('idValue')". Once you have that, you can hook up to the event, but again, it's in script at runtime.


My understanding is that the extenders act as a helpers or wrappers for the atlas behaviors so that they can be used easier from Visual Studio(please correct me if i'm wrong). This means that the properties from the CollapsiblePanelProperties are passed to the CollapsiblePanelBehaviour.
Wouldn't it be possible then to pass the name of the event handler as a text property? Of course the event handler would have to be a javascript function, but the assignment could be done at design time, just like when the behaviors are used without the extenders, something like this:

<textBox id="myTextBox"> <behaviors> <clickBehavior click="onTextBoxClick" /> <keyPressBehavior keypress="onTextBoxKeyPress" /> </behaviors> </textBox>

Thank you,
Vlad

Yes you're right - I misread your question.

This is a good idea - thanks for bringing it up. One thing we're kind of sturggling with is how much to blur the client and server models. We've already crossed this line in a few places (very similar to what you propose actually) and I need to do more thinking about what the pattern is here. So you've "planted the seed", let me think more about this, what the semantics are, etc.

Shawn

Escape Key Behaviour

Hey,

One of my users just discovered the following:

If you hit ESC twice when on a page containing an update panel with a control inside, if you click on anything else that does a postback, you'll get aSystem.ArgumentException: Invalid postback or callback argument. Event validation is enabled using [...] error.

I would like to know more about the default behaviour of the ESC key. And might be interested in hooking up to the event to fire something else when that happens.

Note: I am still using the July CTP (haven't had time / fond it necessary to upgrade yet, so maybe this issue no longer exists now).

Thanks,

Jason

Okay just upgraded to 1.0 RTM and I'm no longer gettingpostback or callback argument exceptions. However, if I do it during a postback, I do see that my updateprogress stays open. In my old one, it didn't seem to have any effect.

Are there any references to the escape key behaviour?

Jason