Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Value from a DTC-grid

Status
Not open for further replies.

wf

Programmer
Feb 1, 2001
32
US
How can I get the value of one cell in a DTC-grid? Maybe in a click event or something like that.
 
You will need to create a 'link' in the required column, so type...

='<A HREF=&quot;Javascript:alert(\'' + [COLNAME] + '\')&quot;>' + [COLNAME] + '</A>'

(or similar) Where [COLNAME] is the name of a recordset column INCLUDING THE SQUARE BRACKETS! Change the 'alert' to any CLIENT side function that your page contains.

When the DTC builds the grid, the cells in that column should now contain
<A HREF=&quot;Javascript:alert('fred')&quot;>fred</A>
Click one to get an alert dialog popup.

Now, typing this link - particularly with mixtures of single and double quotes - can get tricky. Particularly into the confined space of the DTC property editor.

Try typing

=myFunction([COLNAME])

and adding a SERVER SIDE function, in VBScript or JScript, that returns the HTML text for the link

function myFunction(i_strLink)

myFunction = &quot;<A HREF=&quot;&quot;Javascript:alert('&quot; _
& i_strLink & &quot;')&quot;&quot;>&quot; _
& i_strLink & &quot;</A>&quot;

end function

Next you may want the selected value to be sent back to the SERVER for processing.

Add a SERVER-side function (myServerFunction), and add it to a PAGE object DTC, as a NAVIGATE method. Now adjust the 'alert' above to...
thisPage.navigate.myServerFunction

You could also make it an EXECUTE method - for which you must guarantee that the end-user has Java Applets enabled. In this case the method is executed on the server BUT the user does not move off the current page. All results are passed back with the function call - ie the function could return a number or string...
alert(thisPage.execute.myServerExecFN(..))
and the myServerExecFN could perform a database lookup based on the supplied parameters (e.g. Login name/password).

Enough info?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top