Showing posts with label responding. Show all posts
Showing posts with label responding. Show all posts

Wednesday, March 28, 2012

Modal Popup and Formview. first click not responding

i'm running into an issue when i put a modal popup in a formview where when i first click on the linkbutton, the modalpopup does not appear but instead it postbacks. But then on the second click and any clicks after that, the modalpopup will appear.

anyone run into this problem before and does anyone know how i could fix this issue? thanks.

My Immediate suggestion would be wrap the gridview and formview .Net UI code in a ajax Update Panel. Unless you are handling the select and the display of the FormView servser-side - it would be safe to assume that would be the default behavior. The reason I say that is until the Modal is actually invoked - its not really resident - just part of the DOM and not part of the ASP.Net page... If you tie what event you are using to invoke the formview to showing the modal using the serverside show() hide() methods - and you have that all wrapped up into a updatepanel on the UI side - you should get a seamless ModalPopUp experience... There may be better ways - but that is at least how I handle it...


http://forums.asp.net/thread/1441672.aspx might be relevant, too.

Modal Popup events not responding

I have a modal popup control that is created dynamically along with various other controls on Page_Init. Actually it's a user control created dynamically, and part of that user control is the modal popup.

Inside the modal popup is basically just a grid view with some hyperlink columns. The problem is that none of the links ever seem to respond. The popup is shown by a serverside call to the Show() method.

I experimented and put a few buttons and various other controls, and while the button animates like it's been pressed, no server code fires. This happens reguardless of the control type; radiobuttons won't even check. This occurs in controls both inside and outside of the gridview.

Anyone run into something similar with a dynamically created modal popup?

When the controls are being created dynamically, are you attaching events to the objects that will be posting back (ie the modal popup window). I have a similar situation where I have a user control that dynamically creates buttons. The buttons did not work until I added a event handler once I created them. When you add conntrols to a page, this is done automatically, but If you create a control dynamically, you must tell the page what to do with its events when they are raised. Make sence?

-Alan


Yes, it makes sense. The standard events that are tied into the controls, Page_Load, Page_PreRender, etc. all fire fine at the right times. It's only UI events like Click that don't respond on the server side. I can get them to execute javascript (of course) but I'd like to avoid having to hack together a callback function just to get a button working. Besides wiring the buttons/links/etc with events directly from the aspx page, I've tried adding the controls dynamically also (within the dynamically created user control housing the modalpopup) and then wiring them to the events.

Adding the controls that way in the user control's Load, and Init events both yield the same results. The code gets run and the controls get created, but they do not respond to UI events.