HLRosenberger
asked on
Global variable
Does VB.NET have the concept of a variable that is global to my WEB app? IF so, can I define a global variable that is of type BUTTON, and then set this variable on one WEB form and call it's CLICK event from another WEB form?
I think what you really want to do is create a class. global variables, as you described them, are really classes with pre-defined functionality that you can incorporate into an asp.net page, which is also a class.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you explain in a little more detail what it is you are trying to achieve?
If you want to click a button on another page from your current page then you would have to look for alternatives.
ASKER
Yes, I want to click a button on another page from your current page. I posted other questions here about this issue, but I cannot get this to work. From Javascript, I want to click the button on another page.
Are you loading the other page within a frame on current page? What is the functional requirement? Is the other page your own page? You can use query string to the other page and the page can execute code within the button based on query string when it loads.
ASKER
Actually, the one page is a popup and I just found out that a popup using showModalDialog can return a value. So, now I'm returning a value and based on the value I need to call the click event of a button on the same page using JavaScript.
ASKER
That's the type of thing I have tried. But my variable always comes back NULL, even though I am specifying the correct ID - at least I think so.
From the example, what does this mean: TagsHelperConfig.FORM_TAGS _ENTRY_SUB MIT_BUTTON _ID
Here's my line of JavaScript and the HTML for my button:
var xx = window.document.getElement ById('Unid entified_D ocumentsRe freshButto n');
<asp:ImageButton runat="server" id="Identified_DocumentsRe freshButto n" causesvalidation="False" commandname="ResetData" imageurl="../Images/Button BarRefresh .gif" onmouseout="this.src='../I mages/Butt onBarRefre sh.gif'" onmouseover="this.src='../ Images/But tonBarRefr eshOver.gi f'" tooltip="<%# GetResourceValue("Btn :Refresh&q uot;, "MyApp99") %>">
From the example, what does this mean: TagsHelperConfig.FORM_TAGS
Here's my line of JavaScript and the HTML for my button:
var xx = window.document.getElement
<asp:ImageButton runat="server" id="Identified_DocumentsRe
Well the problem I see is
...getElementById('Unident ified....
vs
...id="Identified...
Obviously Unidentified is not equal to Identified!
...getElementById('Unident
vs
...id="Identified...
Obviously Unidentified is not equal to Identified!
ASKER
I'm sorry. There are two refresh buttons on the page - one for Identified and one for Unidentified. And two corresponding buttons that when clicked display my popup. Thus two places where I check the return value from the popup. So, I merely copied and pasted the wrong HTML code.
So, this does not explain why its not working..
So, this does not explain why its not working..
Check the html of the page when its rendered to see what is the name of the button. ASP.NET adds the parent container's name to the child controls' names.
ASKER
I found the problem:
This works:
var RefreshButton= window.document.getElement ById("<%= Unidentified_DocumentsRefr eshButton. ClientID %>");
This does not:
var RefreshButton= window.document.getElement ById('Unid entified_D ocumentsRe freshButto n');
This works:
var RefreshButton= window.document.getElement
This does not:
var RefreshButton= window.document.getElement
ASKER
Thanks.
How was the selected solution relevant to you?
ASKER
using global variables, which was part of my question.
And the answer to click the button I found on my own. (see my previous post)
And the answer to click the button I found on my own. (see my previous post)
You were talking about global button not variable.
ASKER
But a global is a global, no? Data type is irrelevant.
Data Type is relevant because not all variables hold data. Button is an object and contains data, functionality, and user interface.