Execute client script from behind code on server

jlhuber

New member
Joined
Jun 19, 2004
Messages
3
Programming Experience
10+
I have a client side html button:


<button style="LEFT: 450px; POSITION: relative; BACKGROUND-COLOR: #8799cc" onclick="execute"
type="button" id="button2" disabled>Crossload</button>


It executes this script to run a local program on the client:
<script language="VBScript">
sub execute
set objShell=CreateObject("Wscript.Shell")
objShell.Run("PgmFile.exe")
end sub
</script>


The button is initially DISABLED and I want to programatically reset or initiate a reset of this property in asp from the web form's behindcode.

How can I accomplish this?
Thanks
Jack
 

k89mmk

Member
Joined
Jun 7, 2005
Messages
6
Location
n/a
Programming Experience
3-5
Add runat="server" to your button parameters like this:

VB.NET:
 <button style="LEFT: 450px; POSITION: relative; BACKGROUND-COLOR: #8799cc" onclick="execute" type="button" id="button2" disabled [b]runat="server"[/b]>Crossload</button>

and that should add the WithEvents declaration in your code behind, which will let you do this in the code behind:

VB.NET:
 button2.Disabled = False
 
Top Bottom