CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Popup Window Pass variable from Grid

Print topic Send  topic

Author Message
bbinstock

Posts: 6
Posted: 11/13/2009, 9:48 AM

I have tried numerous ways of doing this without success. I have used the Popup windows on forms and editable grids without issue using the document."formname"."field".value syntax. However I have not been able to get this to work from a Grid.

I have a grid with several columns, I added a column with a hyperlink calling the OpenPopupList() function. I need to pass the value from the EventOutputID label of the particular row where the link is being clicked into the popup windows URL variable.

I have no issue creating a hyperlink and passing this variable to an HREF new windows, but cannot get this to work with the popup window. I have added the alert to the function to popup a message containing the value if I did happend to get the right element value retrieved.

<script language="JavaScript">
function OpenPopUpList()
{
var w_left = Math.ceil((screen.width-480)/2);
var OutputNum = document.getElementById.("EventOuputID").value;
alert (OutputNum);
window.open ("Client_NewSubscription.asp?EventOutputID="+OutputNum,"Subscribe", "top=10,left="+w_left+",width=480,height=340,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");

}
</script>
View profile  Send private message
Oper


Posts: 1190
Posted: 11/13/2009, 4:29 PM

change a bit you logic.

Create the popup function like this

  
function OpenPopuplist(Outputnum)  
{  
...  
...  
}  

the on the <a Href
<a href=".........." onclick="OpenPopuplist({EventOuputID});return false;.............

normaly i create the <a href on the before show label CONTEXT html
  
sender.value="<a href=""...."." onclick=""OpenPopuplist(" & from.EventOuputID.value & ");return ""  

that work perfect.




_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
andrewi

Posts: 154
Posted: 11/14/2009, 9:39 AM

I use the method that Codecharge provide in their examples, which is one step simpler than Oper's method (if I've understood correctly),

First, create a normal link with all the parameters you need to display the record you want. Since EventID is one of the grid columns, you can set this parameter using the Codecharge HrefSource editor as normal.

Get this working so that it displays the page you want when clicking the link - though at this stage it will be in the same window.

All you then have to do to make the link open in a popup window is to handle the onclick event. I use a standard popwindow function as listed below. The advantage of this method is that you don't have to modify the function for different situations, it will work whatever page you want to popup.

This is the javascript function
  
function popWindow(ctl, intHeight, intWidth, winName){  
        var linkref = ctl.href;  
        var win=window.open(linkref, winName, "left=100,top=10,width="+intWidth+",height="+intHeight+  
        ",status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");  
        win.focus();  
	return false;  
}  


And here's an example from a grid where I've used it:
<a href="{lnkNew_Src}" id="lstCertslnkNew_{lstCerts:rowNumber}" onclick="return popWindow(this, 550, 550, 'certWin');">New certificate</a>

As you can see, codecharge takes care of the linked page and all parameters. these are all available to the function through using the 'this' reference. All I had to do manually was add the onclick event.

View profile  Send private message
Oper


Posts: 1190
Posted: 11/15/2009, 6:51 AM

Andrewi you are right.


i just like to build the popup serverside,
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
bbinstock

Posts: 6
Posted: 11/15/2009, 8:14 AM

Thanks for the feedback. Both methods do work perfectly.

B
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.