Laurent

Laurent

  • NA
  • 1
  • 3.7k

Execute a client-side VbScript code from a GridView button.

Mar 26 2008 11:03 AM

My problem is :

I would like to execute a client-side VbScript code by clicking on a button in a GridView.

This VbScript code displays a molecule file in a molecules Viewer at the client's side.

I have a GridView which displays the molecules and a button on each row.
By clicking on a button I would like to display the molecule of the chosen row in the molecules Viewer by executing the Vbscript code.

Could you help me ?

Here is my code which doesn't compile :

<scriptlanguage="VBScript">
window.resizeto 310,700
window.moveto 25,25

' Create an instance of the event sink.
Set snk = CreateObject( "Tripos.DynamicEventSink" )

snk.MoleculeAdd = GetRef( "OnMoleculeAdd" )
snk.MoleculeRemove = GetRef( "OnMoleculeRemove" )

' Now hook up the event sink with the event source.
Set app = CreateObject( "Lithium.Application.1" )
Set mdl = app.ActiveModel
Call snk.Advise(mdl)
Sub

LoadMolecule(filename2)
app.Visible= True
' point to files in my local installation
filename = "C:\Bench3DExplorer\20080226\Http\Web_Interaction2\" + filename2
Call mdl.ImportFile(fileName)
Call mdl.Views(1).UpdateChanges
End

Sub
</ script >

< asp : gridview id ="GridView2" AutoGenerateColumns = "false" runat ="server" datasourceid ="ObjectDataSource1" AllowPaging ="True" AllowSorting ="True" DataKeyNames ="Name" onrowcommand ="GridView2_RowCommand" onrowcreated ="GridView2_RowCreated">

< Columns >

< asp : BoundField DataField ="Pdb" HeaderText ="Pdb" InsertVisible ="False" ReadOnly ="True" SortExpression ="Pdb" />

< asp : buttonfield buttontype ="Image" ImageUrl ="~/B3d/green.jpg" commandname ="B3DDisplayMol" onclick ="LoadMolecule( <%= Pdb %> ) />

</ Columns >

Thank you very much for your answers.

Laurent