Reworked ModalPopup

Rate It (1)

Last post 10-29-2006 6:16 PM by RTernier. 36 replies.

Sort Posts:

  • Reworked ModalPopup

    06-29-2006, 5:26 AM
    • Member
      185 point Member
    • AdamDuritz99
    • Member since 05-06-2006, 10:05 PM
    • Posts 37

    With great thanks to stoneym, IDisposable,Ricardo Francisco is not online. Last active: 06-28-2006, 1:46 PM Ricardo Francisco, and the Atlas Control Toolkit Team, I've reworked the ModalPopupExtender to fix many of the bugs.

    Highlights:

    • You can submit through an updatepanel without setting UseSubmitBehavior to false. (requires new property onOkSubmitNormal to True)
    • I believe the doctype problem is fixed.
    • Works better with updatepanels.
    • Objects are being destroyed properly.

    There is a new property called onOkNormalSubmit which is default False, the way the toolkit is normally setup as.  To use this property you will have to modify the .cs files too.

    Here's the Javascript code:

     

     
    // (c) Copyright Microsoft Corporation.
    // This source is subject to the Microsoft Permissive License.
    // See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
    // All other rights reserved.
    
    Type.registerNamespace('AtlasControlToolkit');
    AtlasControlToolkit.ModalPopupBehavior = function() {
        AtlasControlToolkit.ModalPopupBehavior.initializeBase(this);
    
        //
        // Variables
        //
    
        // Custom properties
        var _PopupControlID;
        var _BackgroundCssClass;
        var _DropShadow = false;
        var _OkControlID;
        var _CancelControlID;
        var _OnOkScript;
        var _OnCancelScript;
        var _OnOkNormalSubmit;
    
        // Member variables
        var _showHandler;
        var _okHandler;
        var _cancelHandler;
        var _scrollHandler;
        var _resizeHandler;
        
        // Only used when drop shadows are on
        var _dropShadowBehavior;
        var _foregroundElementControl;
        
        // Disable/Restore Tab variables
        var _saveTabIndexes = new Array();
        var _saveDesableSelect = new Array();
        var _tagWithTabIndex = new Array('A','BUTTON','TEXTAREA','INPUT','IFRAME');	
        
        //
        // Overrides
        //
    
        this.initialize = function() {
        
      
     
            AtlasControlToolkit.ModalPopupBehavior.callBaseMethod(this, 'initialize');
    
            var foregroundElement = $(_PopupControlID);
            foregroundElement.style.display = 'none';
            foregroundElement.style.position = 'absolute';
    
            // Note: Safari doesn't support cancellation of link clicks added by
            // addEventListener, so we must add them with "onclick ="
    
            _showHandler = Function.createDelegate(this, this._onShow);
            this._attachOnClick(this.control.element, _showHandler);
    
            if (_OkControlID) {
                _okHandler = Function.createDelegate(this, this._onOk);
            }
    
            if (_CancelControlID) {
                _cancelHandler = Function.createDelegate(this, this._onCancel);
               
            }
    
            _scrollHandler = Function.createDelegate(this, this._onLayout);
            _resizeHandler = Function.createDelegate(this, this._onLayout);
       }
    
        this.dispose = function() {
    	           
             this._hide();
                 
            _scrollHandler = null;
            _resizeHandler = null;
    
            this._detachOnClick($(_CancelControlID), _cancelHandler);
            this._detachOnClick($(_OkControlID), _okHandler);
            this._detachOnClick(this.control.element, _showHandler);
    
            var applicationMarkupContext = Sys.Application.getMarkupContext();
    
            if (applicationMarkupContext) {
                applicationMarkupContext.removeObject(this);
            }
    
            AtlasControlToolkit.ModalPopupBehavior.callBaseMethod(this, 'dispose');
        }
    
        this.getDescriptor = function() {
            var td = AtlasControlToolkit.ModalPopupBehavior.callBaseMethod(this, 'getDescriptor');
    
            //  Add property declarations
            td.addProperty('PopupControlID', String);
            td.addProperty('BackgroundCssClass', String);
            td.addProperty('DropShadow', Boolean);
            td.addProperty('OnOkNormalSubmit', Boolean);
            td.addProperty('OkControlID', String);
            td.addProperty('CancelControlID', String);
            td.addProperty('OnOkScript', String);
            td.addProperty('OnCancelScript', String);
    
            return td;
        }
    
        //
        // Custom methods
        //
        this._attachOnClick = function(element, handler) {
            if (element) {
                if (window.__safari) {
                    element.onclick = handler;
                } else {
                    element.attachEvent('onclick', handler);
                }
            }
        }
    
        this._detachOnClick = function(element, handler) {
            if (handler) {
                if (element) {
                    element.detachEvent('onclick', handler);
                }
                
                handler = null;
            }
        }
    
        this._attachPopup = function(foregroundElement) {
    
            foregroundElement.style.display = 'none';
            foregroundElement.style.position = 'absolute';
    
            var backgroundElement = document.createElement('div');
            backgroundElement.id = 'ModalBackgroundDIV';
    
            backgroundElement.style.display = 'none';
            backgroundElement.style.position = 'absolute';
    
            if (_BackgroundCssClass) {
                backgroundElement.className = _BackgroundCssClass;
            }
            
            foregroundElement.parentNode.appendChild(backgroundElement);
            
            if (_OkControlID) {
                this._attachOnClick($(_OkControlID), _okHandler);
            }
    
            if (_CancelControlID) {
                this._attachOnClick($(_CancelControlID), _cancelHandler);
            }
    
            if (_DropShadow) {
                _foregroundElementControl = new Sys.UI.Control(foregroundElement);
                _dropShadowBehavior = new AtlasControlToolkit.DropShadowBehavior();
                _foregroundElementControl.get_behaviors().add(_dropShadowBehavior);
                _dropShadowBehavior.initialize();
            }
    
            window.attachEvent('onresize', _resizeHandler);
            window.attachEvent('onscroll', _scrollHandler);
            
             
            
            return backgroundElement;       
        }
    
        this._detachPopup = function(foregroundElement, backgroundElement) {
        
            if (_scrollHandler) {
                window.detachEvent('onscroll', _scrollHandler);
            }
            
            if (_resizeHandler) {
                window.detachEvent('onresize', _resizeHandler);
            }
    
            if (_dropShadowBehavior) {
                _dropShadowBehavior.dispose();
                
                if (_foregroundElementControl) {
                    _foregroundElementControl.get_behaviors().remove(_dropShadowBehavior);
                    _foregroundElementControl = null;
                }
              
                _dropShadowBehavior = null;
            }
                
    		if (backgroundElement && foregroundElement) {
    			if (backgroundElement.id == 'ModalBackgroundDIV') 
    			{
    				foregroundElement.parentNode.removeChild(backgroundElement);
    			}
    		} 
    	}
    
        this._onShow = function(e) {
        
            this._show();
            
         
            event.returnValue = false;
        
            return false;
            
        }
    
        this._onOk = function() {
            this._hide();
          
            if (!_OnOkNormalSubmit) {
    			
    			 event.returnValue = false;
    			
            } else {
           
    			event.returnValue = true;
    		}
           
            if (_OnOkScript) {
            
                window.setTimeout(_OnOkScript, 0);
             
            }
         
            if (!_OnOkNormalSubmit) {
    			
    			 return false;
    			
            } else {
           
    			return true;
    		}
           
        }
    
        this._onCancel = function() {
      
            this._hide();
            event.returnValue = false;
            if (_OnCancelScript) {
                window.setTimeout(_OnCancelScript, 0);
            }
            return false;
        }
    
        this._onLayout = function() {
            var foregroundElement = $(_PopupControlID);
            var backgroundElement = foregroundElement.parentNode.lastChild;	
         
                   
            this._layout(foregroundElement, backgroundElement);
        }
        
        this._show = function() {
       
            var foregroundElement = $(_PopupControlID);
            var backgroundElement = this._attachPopup(foregroundElement);
           
              
            this._updateZIndex(foregroundElement, backgroundElement);
                
    
            foregroundElement.style.display = 'block';
            backgroundElement.style.display = 'block';
            
            //Disable Tab
            this.disableTab(foregroundElement);  
            
                   
            this._layout(foregroundElement, backgroundElement);
             
            // On pages that don't need scrollbars, Firefox and Safari act like
            // one or both are present the first time the layout code runs which
            // obviously leads to display issues - run the layout code a second
            // time to work around this problem
            this._layout(foregroundElement, backgroundElement);
             
        }
        
        
        this._hide = function() {
    
            var foregroundElement = $(_PopupControlID);
    		var backgroundElement;
    
            if (foregroundElement) 
            {
    			foregroundElement.style.display = 'none'
    			
    			if (foregroundElement.parentNode.hasChildNodes())
    			{
    			
    				if (foregroundElement.parentNode.lastChild.id == 'ModalBackgroundDIV')
    				{
    					backgroundElement = foregroundElement.parentNode.lastChild;
    					backgroundElement.style.display = 'none';	
    				}
    					
                }
                
    	        this.restoreTab();       
    		}
         
            this._detachPopup(foregroundElement, backgroundElement);      
        
        }
    
        this._updateZIndex = function(foregroundElement, backgroundElement) {
            if (!backgroundElement || !foregroundElement) return;
        
            var foregroundZIndex = foregroundElement.style.zIndex;
            var backgroundZIndex = backgroundElement.style.zIndex;
            
            if (backgroundZIndex && foregroundZIndex && foregroundZIndex > backgroundZIndex) {
                return;
            }
            else {               
               foregroundZIndex = Math.max(2, foregroundZIndex);   
               backgroundZIndex = foregroundZIndex - 1;                
            }
            
            foregroundElement.style.zIndex = foregroundZIndex;          
            backgroundElement.style.zIndex = backgroundZIndex;        
        }
    
        this._layout = function(foregroundElement, backgroundElement) {
            if (!backgroundElement || !foregroundElement) return;
    
            var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
            var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
            
    		var clientWidth; 
    
    		if (window.innerWidth){ 
    			clientWidth = (window.__safari ? window.innerWidth : Math.min(window.innerWidth, document.documentElement.clientWidth));
    			
    		} else if (document.documentElement && document.documentElement.clientWidth){ 
    		
    			clientWidth = document.documentElement.clientWidth;
    			
    		} else if (document.body){ 
    		
    			clientWidth = document.body.clientWidth;
    			
    		} else { 
    		
    			clientWidth = document.documentElement.clientWidth;
    		}
    
    
    		var clientHeight; 
    	
    		if (window.innerHeight) { 
    		
    			clientHeight = (window.__safari ? window.innerHeight : Math.min(window.innerHeight, document.documentElement.clientHeight));
    			
    		} else if (document.documentElement && document.documentElement.clientHeight){ 
    		
    			clientHeight = document.documentElement.clientHeight;
    			
    		} else if (document.body){ 
    		
    			clientHeight = document.body.clientHeight;
    			
    		} else { 
    		
    			clientHeight = document.documentElement.clientHeight;
    		}
    
    
            backgroundElement.style.left = scrollLeft+'px';
            backgroundElement.style.top = scrollTop+'px';
            backgroundElement.style.width = clientWidth+'px';
            backgroundElement.style.height = clientHeight+'px';
    
            foregroundElement.style.left = scrollLeft+((clientWidth-foregroundElement.offsetWidth)/2)+'px';
            foregroundElement.style.top = scrollTop+((clientHeight-foregroundElement.offsetHeight)/2)+'px';
    
            if (_dropShadowBehavior) {
                _dropShadowBehavior.setShadow();
                window.setTimeout(Function.createDelegate(this, this._fixupDropShadowBehavior), 0);
             
            }
        }
    
        // Some browsers don't update the location values immediately, so
        // the location of the drop shadow would always be a step behind
        // without this method
        this._fixupDropShadowBehavior = function() {
            if (_dropShadowBehavior) {
                _dropShadowBehavior.setShadow();
            }
        }
        
         this.disableTab = function(foregroundElement) {
    	    var i = 0;
    	    var tagElements;
    	    var tagElementsInPopUp = new Array();
    	    _saveTabIndexes.clear();
    
            //Save all popup's tag in tagElementsInPopUp
    	    for (var j = 0; j < _tagWithTabIndex.length; j++) {
    		    tagElements = foregroundElement.getElementsByTagName(_tagWithTabIndex[j]);
    		    for (var k = 0 ; k < tagElements.length; k++) {
    			    tagElementsInPopUp[i] = tagElements[k];
    			    i++;
    		    }
    	    }
    
            i = 0;
    	    for (var j = 0; j < _tagWithTabIndex.length; j++) {
    		    tagElements = document.getElementsByTagName(_tagWithTabIndex[j]);
    		    for (var k = 0 ; k < tagElements.length; k++) {
    			    if (tagElementsInPopUp.indexOf(tagElements[k]) == -1)  {
    			        _saveTabIndexes[i] = {tag: tagElements[k], index: tagElements[k].tabIndex};
    			        tagElements[k].tabIndex="-1";
    		            i++;
    		        }
    		    }
    	    }
    		//IE6 Bug with SELECT
    		i = 0;
    		if (navigator.userAgent.indexOf('MSIE 6.0') != -1) {
    			//Save SELECT in PopUp
    			var tagSelectInPopUp = new Array();
    			for (var j = 0; j < _tagWithTabIndex.length; j++) {
    		        tagElements = foregroundElement.getElementsByTagName('SELECT');
    		        for (var k = 0 ; k < tagElements.length; k++) {
    			        tagSelectInPopUp[i] = tagElements[k];
    			        i++;
    		        }
    	        }
    
    		    i = 0;
    		    _saveDesableSelect.clear();
    		    tagElements = document.getElementsByTagName('SELECT');
    		    for (var k = 0 ; k < tagElements.length; k++) {
    			    if (tagSelectInPopUp.indexOf(tagElements[k]) == -1)  {
                        _saveDesableSelect[i] = {tag: tagElements[k], visib: tagElements[k].style.visibility} ;
                        tagElements[k].style.visibility = 'hidden';
                        i++;
                    }
                }
            }
    
        }
        
        this.restoreTab = function() {
    	    for (var i = 0; i < _saveTabIndexes.length; i++) {
    		    _saveTabIndexes[i].tag.tabIndex = _saveTabIndexes[i].index;
    	    }
    		//IE6 Bug with SELECT
    		if (navigator.userAgent.indexOf('MSIE 6.0') != -1) {
    		    for (var k = 0 ; k < _saveDesableSelect.length; k++) {
                    _saveDesableSelect[k].tag.style.visibility = _saveDesableSelect[k].visib;
                }
            }
        }
    
        //
        // Property get/set methods
        //
    
        this.get_PopupControlID = function() {
            return _PopupControlID;
        }
    
        this.set_PopupControlID = function(value) {
            _PopupControlID = value;
        }
    
        this.get_BackgroundCssClass = function() {
            return _BackgroundCssClass;
        }
    
        this.set_BackgroundCssClass = function(value) {
            _BackgroundCssClass = value;
        }
    
        this.get_DropShadow = function() {
            return _DropShadow;
        }
    
        this.set_DropShadow = function(value) {
            _DropShadow = value;
        }
        
          this.get_OnOkNormalSubmit = function() {
            return _OnOkNormalSubmit;
        }
    
        this.set_OnOkNormalSubmit = function(value) {
           _OnOkNormalSubmit = value;
        }
    
        this.get_OkControlID = function() {
            return _OkControlID;
        }
    
        this.set_OkControlID = function(value) {
            _OkControlID = value;
        }
    
        this.get_CancelControlID = function() {
            return _CancelControlID;
        }
    
        this.set_CancelControlID = function(value) {
            _CancelControlID = value;
        }
    
        this.get_OnOkScript = function() {
            return _OnOkScript;
        }
    
        this.set_OnOkScript = function(value) {
            _OnOkScript = value;
        }
    
        this.get_OnCancelScript = function() {
            return _OnCancelScript;
        }
    
        this.set_OnCancelScript = function(value) {
            _OnCancelScript = value;
        }
    }
    
    AtlasControlToolkit.ModalPopupBehavior.registerSealedClass('AtlasControlToolkit.ModalPopupBehavior', Microsoft.AtlasControlExtender.BehaviorBase);
    Sys.TypeDescriptor.addType('atlascontroltoolkit', 'modalPopupBehavior', AtlasControlToolkit.ModalPopupBehavior);
    
     
  • Re: Reworked ModalPopup

    06-29-2006, 2:13 PM
    • Star
      8,710 point Star
    • David Anson
    • Member since 04-10-2006, 9:39 PM
    • Microsoft
    • Posts 1,842
    • AspNetTeam

    Wow, very neat!!

    Could a few people who already use ModalPopup please try out the proposed changes here and reply back with your findings? If everyone agrees these are good improvements to have and doesn't run into any new problems, I'll go ahead and check them into CodePlex for inclusion with the next release.

    Adam, could you please write a brief description of exactly what problems this code fixes w.r.t. the 60626 release? I assume this version passes the relevant automated tests we released with 60626, right? Would it be possible for you to modify the automated tests so that they demonstrate one or more of the problems with the existing release? That would help us know that the changes fix the problems AND help avoid introducing regressions in the future.

    Thanks everyone - it's been great to see the community interest in ModalPopup!!


    http://blogs.msdn.com/delay

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Reworked ModalPopup

    06-29-2006, 6:13 PM
    • Member
      185 point Member
    • AdamDuritz99
    • Member since 05-06-2006, 10:05 PM
    • Posts 37

    To be honest I'm not really much of a javascript programmer, I just kept finding little quirks and debugged them until everything in my project started working completely.  A lot of the changes are to make the modalpopup more flexible.  In its original form without using updatepanels, it does just fine.  However I use the _onOk(), _onShow(), _onCancel() methods directly.  Also I'm using the extender in serveral different webusercontrols. In doing all of that I've found serveral bugs. Many of the fixes come from users here at asp.net, which I've named earlier.

    A major change is the initializing method which can be read about here: http://forums.asp.net/1/1289843/ShowThread.aspx

    The reason why users had to disable usesubmitbehavior is due to the onOk method stopping the postback.  I created a new property called onOkNormalSubmit.  When this is set to true, the postback will not be disabled.

    I gave the backgroundElement and ID  to make sure the appropriate element would be destroyed during the detachPopup() method.  Also during the dispose method if background element is available, it will destroy it, but it's already destroyed there won't be a javascript error to appear. This became really problematic for me using webusercontrols.

    Though I don't remember the exact bug I found, the element.style.display  = '' has been changed to element.style.display = 'block' .  I believe at one point the backgroundElement would not be displayed just using  display = ''.

    A method called UpdateZIndex was created by IDisposable.  The users now shouldn't have to worry about any zindex settings.

    Ricardo Francisco, fixed the DOCTYPE bug.  I just included it in the code.

    In it's current form the code doesn't pass the Toolkit Test because it looks for element.style.display = ''.  I changed it to .display = 'block', and it passes just fine.  Like I said earlier, I'm not much of a javascript programmer.  I looked at the Toolkit Test for a while to see if I can help out any.  Unfortantly, I don't think I have enough knowledge to make any tests.  A suggestion is to do the test in an updatepanel too. 

     

    -Sean

     

  • Re: Reworked ModalPopup

    06-30-2006, 3:55 PM
    • Star
      8,710 point Star
    • David Anson
    • Member since 04-10-2006, 9:39 PM
    • Microsoft
    • Posts 1,842
    • AspNetTeam

    Thanks for the details!

    I'd still like to hear back from some other folks that they're happy with these changes and that they don't break any other scenarios. Once I get that info, I'll look into getting these changes integrated and tested.

    Again, thanks very much for helping improve the Toolkit!!


    http://blogs.msdn.com/delay

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Reworked ModalPopup

    07-01-2006, 6:37 AM
    • Member
      548 point Member
    • sixtus
    • Member since 04-02-2006, 4:48 PM
    • Posts 191

    how do I change do if I want to check the new code ?

    I assume that it is the file ModalPopupbehavior.js that has to be changed. But want do I have to do afterwards ?

  • Re: Reworked ModalPopup

    07-03-2006, 1:37 PM
    • Star
      8,710 point Star
    • David Anson
    • Member since 04-10-2006, 9:39 PM
    • Microsoft
    • Posts 1,842
    • AspNetTeam
    Change the ModalPopupBehavior.js file, build a new AtlasControlToolkit.dll, update your project reference(s), and try it.

    http://blogs.msdn.com/delay

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Reworked ModalPopup

    07-03-2006, 2:09 PM
    • Member
      220 point Member
    • bugnuker
    • Member since 03-27-2006, 6:26 PM
    • Posts 46

    I've tried to use this new javascript. I am now having problems with the modal in some places.

    I am a bit confused on some of the things that have taken place over the last week.

    First, on codeplex, I saw a new release of the controltoolkit, dated june 27th.

    I downloaded this release. It seems to still be using the 60406 release of the atlas dll.

    Getting some problems there. So i reverted back to my old releases. Things work once again.

    I then saw this post, and was very excited to see these changes, as I've been having some issues that have been floating around in the forums that stoneym and IDisposable have been addressing.

    Once using this new javascript, some of my popups dont work as they were before.

    I need to spend a little more time and work out the kinks of my builds ( i have wayyyy to many releases that i am not keeping track of very well, my main problem is horrible organization)

    Here are some of the problems with modal I am trying to overcome:

    First, taking input from a modal popup, supposivly fixed in this release.

    Second, opening modal popup from links within a gridview (stoneym i think was the main person I was looking to in the forums about that problem)

    Third, A problem with IE and zindexes not displaying properly with listboxes, and other controls. I've found a soulution to that in the forums dealing with the backgroundelement.innerHTML and an Iframe.

    Fourth, I am having a problem with modalpopup and a FreeTextBox control using Firefox. The control does not work properly for some reason, works great in IE.

    I'll play with my releases a bit more, get some orgranization working better hopefully.

    It would be nice to know what Atlas release I should be using to build the new controltoolkit.dll

    Thanks for all your guys help!

    Hope you have a great 4th of july!!

    -Shane

     

  • Re: Reworked ModalPopup

    07-03-2006, 2:16 PM
    • Member
      220 point Member
    • bugnuker
    • Member since 03-27-2006, 6:26 PM
    • Posts 46

    Hey, once again.

    I've tried this new code in both releases of the toolkit, on one release, the popup fails to show what-so-ever, kind of like my problem in my project. In the newest version of the toolkit, the modal shows, and when clicking ok, the background remians gray.

    thanks

    -Shane

     

  • Re: Reworked ModalPopup

    07-03-2006, 4:08 PM
    • Member
      548 point Member
    • sixtus
    • Member since 04-02-2006, 4:48 PM
    • Posts 191

    Sorry for my stupidity.

    How do I build a new AtlasControlToolkit as David Anson writes in a previous message?

     

     
  • Re: Reworked ModalPopup

    07-03-2006, 6:15 PM
    • Member
      185 point Member
    • AdamDuritz99
    • Member since 05-06-2006, 10:05 PM
    • Posts 37

    DETAILED INSTRUCTIONS:

    1. Download the 60626 release at CodePlex.
    2. Open up the <Unzipped Directory>\AtlasControlToolkit\AtlasControlToolkit.csproj file in visual studio 2005.
    3. In the ModalPopup folder find the file ModalPopupBehavior.js.
    4. Completely delete all the code in ModalPopupBehavior.js file.
    5. Add the code supplied in my first post into the ModalPopupBehavior.js file.
    6. Save and close the ModalPopupBehavior.js file.
    7. Find the file ModalPopupProperties.cs.
    8. Completly delete all the code in this file.
    9. Add the following  code below into the ModalPopupProperties.cs file.
    10. Save and close this file.
    11. In the toolbar click on Build>Build Solution  (F6 key)
    12. Copy all the files in <Unzipped Directory>\AtlasControlToolkit\bin\Debug.
    13. Paste these files in your project bin folder.
    14. Rebuild your project. And your done.

     
    // (c) Copyright Microsoft Corporation.
    // This source is subject to the Microsoft Permissive License.
    // See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
    // All other rights reserved.
    
    
    using System;
    using System.Web.UI.WebControls;
    using System.Web.UI;
    using System.ComponentModel;
    using Microsoft.AtlasControlExtender;
    
    namespace AtlasControlToolkit
    {
        /// <summary>
        /// Properties for the ModalPopup
        /// </summary>
        [DefaultProperty("PopupControlID")]
        public class ModalPopupProperties : TargetControlPropertiesBase
        {
            // Property names
            private const string stringPopupControlID = "PopupControlID";
            private const string stringBackgroundCssClass = "BackgroundCssClass";
            private const string stringDropShadow = "stringDropShadow";
            private const string stringOkControlID = "OkControlID";
            private const string stringCancelControlID = "CancelControlID";
            private const string stringOnOkScript = "OnOkScript";
            private const string stringOnCancelScript = "OnCancelScript";
            private const string stringOnOkNormalSubmit = "OnOkNormalSubmit";
    
            [DefaultValue("")]
            [IDReferenceProperty(typeof(WebControl))]
            [RequiredProperty()]
            [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1706:ShortAcronymsShouldBeUppercase", Justification = "Following Atlas pattern")]
            public string PopupControlID
            {
                get { return GetPropertyStringValue(stringPopupControlID); }
                set { SetPropertyStringValue(stringPopupControlID, value); }
            }
    
            [DefaultValue("")]
            public string BackgroundCssClass
            {
                get { return GetPropertyStringValue(stringBackgroundCssClass); }
                set { SetPropertyStringValue(stringBackgroundCssClass, value); }
            }
    
            [DefaultValue(false)]
            public bool DropShadow
            {
                get { return GetPropertyBoolValue(stringDropShadow); }
                set { SetPropertyBoolValue(stringDropShadow, value); }
            }
    
            [DefaultValue("")]
            [IDReferenceProperty(typeof(WebControl))]
            [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1706:ShortAcronymsShouldBeUppercase", Justification = "Following Atlas pattern")]
            public string OkControlID
            {
                get { return GetPropertyStringValue(stringOkControlID); }
                set { SetPropertyStringValue(stringOkControlID, value); }
            }
    
            [DefaultValue("")]
            [IDReferenceProperty(typeof(WebControl))]
            [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1706:ShortAcronymsShouldBeUppercase", Justification = "Following Atlas pattern")]
            public string CancelControlID
            {
                get { return GetPropertyStringValue(stringCancelControlID); }
                set { SetPropertyStringValue(stringCancelControlID, value); }
            }
    
            [DefaultValue("")]
            public string OnOkScript
            {
                get { return GetPropertyStringValue(stringOnOkScript); }
                set { SetPropertyStringValue(stringOnOkScript, value); }
            }
    
            [DefaultValue("")]
            public string OnCancelScript
            {
                get { return GetPropertyStringValue(stringOnCancelScript); }
                set { SetPropertyStringValue(stringOnCancelScript, value); }
            }
            [DefaultValue(false)]
            public bool OnOkNormalSubmit
            {
                get { return GetPropertyBoolValue(stringOnOkNormalSubmit); }
                set { SetPropertyBoolValue(stringOnOkNormalSubmit, value); }
            }
        }
    }
    

     

  • Re: Reworked ModalPopup

    07-04-2006, 4:37 AM
    • Member
      548 point Member
    • sixtus
    • Member since 04-02-2006, 4:48 PM
    • Posts 191

    Thanks - your description is very easy to follow.

    But I have one problem. I am using Visual Web Developer 2005 Express Edition and not Visual Studio 2005.

    How do I then build the solution ? Is it possible ?

    I have tried to read in the directrory AtlasControlToolkit an build, but I doesn't work.

  • Re: Reworked ModalPopup

    07-04-2006, 8:29 AM
    • Member
      185 point Member
    • AdamDuritz99
    • Member since 05-06-2006, 10:05 PM
    • Posts 37

    Download Visual C# Express.  Then install it. The look and feel is very similiar to Visual Web Developer. Then follow the steps as described above.  You will probably get a about 4 warnings/alerts befor the .csproj file will open.  Just click through them.  If one asks how to open the file..  "Open Normally".

    When using the express version, ignore my statement on building the file.  In express after all the modifications are complete, look in the solution explorer near the top.  There will be a parent "folder" in bold called "AtlasToolkitControls".  Right click on it then select build.  After that follow my directions on coping the files from on place to the other.

     

     

  • Re: Reworked ModalPopup

    07-04-2006, 10:22 AM
    • Member
      548 point Member
    • sixtus
    • Member since 04-02-2006, 4:48 PM
    • Posts 191

    Thanks - now I succeded.

    But I got an error when during build. In ModalPopupProperties.cj I got an errormessages in the line:  public class ModalPopupProperties : TargetControlPropertiesBase

    I comparede with the original ModalPopupProperties.cj and there was <control> at the end of the line. I hope it was correct that I added that code. Now the line looks like:

        public class ModalPopupProperties : TargetControlPropertiesBase<Control>

    But unfortunately it doesn't solve the problem I described in the thread http://forums.asp.net/thread/1330523.aspx

  • Re: Reworked ModalPopup

    07-05-2006, 10:15 AM
    • Member
      185 point Member
    • AdamDuritz99
    • Member since 05-06-2006, 10:05 PM
    • Posts 37

    Yes, for some reason when i copied the code over it left out the <control> tag.  I'm glad you got the code to compile.  I'm look at your current problem to see if an improvement can be made.

  • Re: Reworked ModalPopup

    07-05-2006, 11:05 AM
    • Member
      220 point Member
    • bugnuker
    • Member since 03-27-2006, 6:26 PM
    • Posts 46

    Hello guys,

    I am still having the same issue with the modal popup on this new javascript.

    I've downloaded the new release from codeplex (the download contains the 60406 Atlas release, not the 60626, is this a mistake?).

    I apply the new javascript to the new toolkit release, i apply the new source for the .cs properties file. The project builds fine after the <Control> is added. When testing the modal in the included sample application, the screen remains grayed out after an ok, or cancel.

    I have not added any custom code, I have not changed anything in any way. I have just done 100% copy paste and I cant seem to get the darn thing to work with this new javascript.

    Is anyone else having the same problems?

    I would really love to start working with this new version, any input would be helpful.

    thanks

    -Shane

Page 1 of 3 (37 items) 1 2 3 Next >