Archive

Posts Tagged ‘.net’

ModalPopupExtender displays during PageLoad

February 4th, 2010

I’ve noticed that in some of my developments using Ajax.Net the ModalPopupExtender flashes up breifly while some of the elements within the page finish loading. I have noticed this for browsers IE and Firefox, but not Chrome.

There is a very simple solution, you just have to remember to do it everytime you want to use a ModalPopup. Add the style=”display:none;” attribute to the asp:panel you are using as the extender, and this will ensure the ModalPopup remains invisible while the page loads.

Techie , , ,

FileInfo to overwrite when moving files

February 2nd, 2010

The FileInfo.MoveTo method does not accept a parameter to overwrite destination files.

Short of extending this class (which I probably should do if I wasn’t being so lazy), the quickest way to get around this is to use the CopyTo method, set the overwrite parameter to true, and then delete the original file.


// Move an overwrite any destination file
FileInfo f = new FileInfo("SomeFile.txt");
f.CopyTo("SomeDestinationFile.txt", true);
f.Delete();

Techie ,

Javascript call to close ModalPopupExtender

November 5th, 2009

The AJAX.Net ModalPopupExtender comes with the property ‘CancelControlID’, but what if you want to add multiple cancel controls, or trigger the Modal Popup to close based upon an event?

Simple, you can use the following javascript to fire the close event manually.

$find('ModalPopupExtender_Full_Control_ID').hide();

There, I said it was simple didn’t I?

Techie , , ,

Clientside Repositioning a Modal Popup Extender

October 13th, 2009

When using the built in Modal Popup Extender for Ajax .Net, if you add any data or controls dynamically, you will notice that the Modal Popup has become unaligned or has breached it’s original size. Changing the size through CSS and Javascript is simple, however the position of the Modal Popup cannot be achieved in the same way.

To reposition the Modal Popup alignment, simply call the following function within your javascript. This will force the popup to recenter itself within the page.

$find('ModalPopupID')._layout();

Also, for people’s information, there are different properties for the automatic repositioning of the Modal Popup. These probably are never of use, unless you want to prevent the Modal Popup from realigning automatically.

Reposition Mode:

  • None
  • RepositionOnWindowResize
  • RepositionOnWindowResizeAndScroll
  • RepositionOnWindowScroll

Techie , , ,

Bug using Meta Tags with Atlas UpdatePanel

September 1st, 2006

This may sound slightly bizarre, but if you are using atlas in dotnet, and add a meta tag within the head of the page, it prevents partial rendering of the UpdatePanel control.

I couldn’t believe it, and in fact it took me a good few hours to figure out what was happening - Sure enough, it is a bug in atlas, fixed in the July release.

–Radderz 11:50, 1 September 2006 (BST)


In addition to this bug, there seems to be a similar one which has not been fixed with the upgrade. If you access your application settings via the following within the page head, it causes an identical response. It only appears to occur in certain situations (In my one, I was using the appSettings to fill in part of the path to a stylesheet).

<%=ConfigurationManager.AppSettings("URL.Root") %>

For the time being, I can’t think of a situation where this can’t be avoided. But if one does arise, I’ve noticed that you can place this within html comments, it works fine.

<!-- -->

What is the use of this you may say! We’ll, actually, javascript can execute within html comments, so you set a js variable, and use it where you need ;)

–Radderz 20:26, 7 September 2006 (BST)


For existing applications, the above errors can be solved by rebuilding the web.config file from scratch, using the updated atlas template.

I’m still unsure of which line in the web.config causes these bugs, but I have not had much time other then initial inspection to investigate. If you end up spotting it, please add it here :)

–Radderz 09:21, 14 September 2006 (BST)

Techie , ,