locked
To open a new window and take input RRS feed

  • Question

  • User916960176 posted

     Hi,

    To take input from the user I have a button. I'd like it to work like this. When the user clicks on the button in the current web page a window should appear which displays a page which has 2 text boxes and a button. When the user enter the values into the text box and clicks the button I want that window to close and I want to access the values entered in the current web page. Can we do this ? if yes please give tips as to how to accomplish this.

    Thanks,



    Manjunath M. R. 

    Friday, August 22, 2008 4:35 AM

Answers

  • User-16411453 posted

     You should write your own code. Here's a starter snippet I wrote for something else.  This took me months to figure out myself with no help.  I wrote the javascript from scratch so it may lack some browser checking functions and some other stuff. 

    the live sample is here http://testdrive.ice5software.com/shoppingcart/index.aspx?d=s

    Press the shipping options button to view the popup panel. 

    This is the main container for the control, it's the base layer with a zindex of 999

     

    panelControl = New Panel
    		panelControl.Attributes.Add("id", [ID] & "_panelDisplayCartShipRateCalculator")
    		panelControl.Visible = [Visible]
    		panelControl.Style.Add(HtmlTextWriterStyle.ZIndex, "999")
    		panelControl.Style.Add(HtmlTextWriterStyle.Position, "relative")
    		UpdatePanel_ShipRateCalculator.ContentTemplateContainer.Controls.Add(panelControl)
      

    This is the trigger for the panel. The trigger will open or close the panel depending on the visibility state of the panel

     

    imgShippingOptions = New Image
    		imgShippingOptions.Attributes.Add("id", "_ShippingOptions")
    		imgShippingOptions.ImageAlign = ImageAlign.AbsMiddle
    		imgShippingOptions.ImageUrl = cs.GetWebResourceUrl(rsType, "ShippingOptions_0.gif")
    		imgShippingOptions.ToolTip = "Click to Change Shipping Rate Options"
    		imgShippingOptions.Attributes.Add("onclick", "rtsrcShowHidePanel('_ShippingOptions', '_RealTimeShipRatePanel');")
    		tdOptions.Controls.Add(imgShippingOptions)
      

     This is the panel that looks like a popup window. it has a zindex value of 1005 so it layers above the base layer of zindex 999

    
    		Dim panel As Panel
    		panel = New Panel
    		panel.Attributes.Add("id", "_RealTimeShipRatePanel")
    		panel.Style.Add(HtmlTextWriterStyle.ZIndex, "1005")
    		panel.Style.Add(HtmlTextWriterStyle.Position, "absolute")
    		panel.Style.Add(HtmlTextWriterStyle.Visibility, "hidden")
    		.Controls.Add(panel)
      This is the Javascript
    function rtsrcShowHidePanel(rtsrcI, rtsrcG) {			
    										
    		if (document.getElementById) { // DOM3 = IE5, NS6
    			if (document.getElementById(rtsrcG).style) {
    				if (document.getElementById(rtsrcG).style.visibility == 'hidden' || document.getElementById(rtsrcG).style.visibility == '') {
    					document.getElementById(rtsrcG).style.visibility = "visible";
    					document.getElementById(rtsrcG).style.display = "block";
    				}
    				else {
    					document.getElementById(rtsrcG).style.visibility = "hidden";
    					document.getElementById(rtsrcG).style.display = "none";				
    				}
    			} 
    		}
    		else {
    			if (document.layers) { // Netscape 4
    				document.rtsrcG.visibility = "visible";
    			}
    			else { // IE 4
    				document.all.rtsrcG.style.visibility="visible";
    			}
    		}	
    			
    	}
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 23, 2008 3:00 PM

All replies

  • User-16411453 posted

     It can be done, but I suggest using a panel <div></div> instead of apop-up window.  With a panel controls, you can take the values and move them because they are in the same control on the same page.  With a popup window, you have to use lots of javascript to grab the values and transfer from the window and write the back to the main screen.

    On the panel, you can set the size to lets say 250px by 250 px, and use the style z-index to set the value 1 level above the main screen.   The panel will appear to pop up to the user.

    Friday, August 22, 2008 5:22 PM
  • User916960176 posted

     Hi,

    Thanks for the reply.

    I don't have any idea as to how to do it. I want the input to be taken only after the person has clicked a button and that should disappear when the person clicks another button in the window and I should be able to access the values entered. How can I do it either using java script or in the codebehind(c#). Please send the code for this if u can.

    Thanks,

    Manjunath M. R. 

    Saturday, August 23, 2008 12:41 AM
  • User-16411453 posted

     You should write your own code. Here's a starter snippet I wrote for something else.  This took me months to figure out myself with no help.  I wrote the javascript from scratch so it may lack some browser checking functions and some other stuff. 

    the live sample is here http://testdrive.ice5software.com/shoppingcart/index.aspx?d=s

    Press the shipping options button to view the popup panel. 

    This is the main container for the control, it's the base layer with a zindex of 999

     

    panelControl = New Panel
    		panelControl.Attributes.Add("id", [ID] & "_panelDisplayCartShipRateCalculator")
    		panelControl.Visible = [Visible]
    		panelControl.Style.Add(HtmlTextWriterStyle.ZIndex, "999")
    		panelControl.Style.Add(HtmlTextWriterStyle.Position, "relative")
    		UpdatePanel_ShipRateCalculator.ContentTemplateContainer.Controls.Add(panelControl)
      

    This is the trigger for the panel. The trigger will open or close the panel depending on the visibility state of the panel

     

    imgShippingOptions = New Image
    		imgShippingOptions.Attributes.Add("id", "_ShippingOptions")
    		imgShippingOptions.ImageAlign = ImageAlign.AbsMiddle
    		imgShippingOptions.ImageUrl = cs.GetWebResourceUrl(rsType, "ShippingOptions_0.gif")
    		imgShippingOptions.ToolTip = "Click to Change Shipping Rate Options"
    		imgShippingOptions.Attributes.Add("onclick", "rtsrcShowHidePanel('_ShippingOptions', '_RealTimeShipRatePanel');")
    		tdOptions.Controls.Add(imgShippingOptions)
      

     This is the panel that looks like a popup window. it has a zindex value of 1005 so it layers above the base layer of zindex 999

    
    		Dim panel As Panel
    		panel = New Panel
    		panel.Attributes.Add("id", "_RealTimeShipRatePanel")
    		panel.Style.Add(HtmlTextWriterStyle.ZIndex, "1005")
    		panel.Style.Add(HtmlTextWriterStyle.Position, "absolute")
    		panel.Style.Add(HtmlTextWriterStyle.Visibility, "hidden")
    		.Controls.Add(panel)
      This is the Javascript
    function rtsrcShowHidePanel(rtsrcI, rtsrcG) {			
    										
    		if (document.getElementById) { // DOM3 = IE5, NS6
    			if (document.getElementById(rtsrcG).style) {
    				if (document.getElementById(rtsrcG).style.visibility == 'hidden' || document.getElementById(rtsrcG).style.visibility == '') {
    					document.getElementById(rtsrcG).style.visibility = "visible";
    					document.getElementById(rtsrcG).style.display = "block";
    				}
    				else {
    					document.getElementById(rtsrcG).style.visibility = "hidden";
    					document.getElementById(rtsrcG).style.display = "none";				
    				}
    			} 
    		}
    		else {
    			if (document.layers) { // Netscape 4
    				document.rtsrcG.visibility = "visible";
    			}
    			else { // IE 4
    				document.all.rtsrcG.style.visibility="visible";
    			}
    		}	
    			
    	}
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 23, 2008 3:00 PM