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!

Setting Grid DTC field/expression - String problems

Status
Not open for further replies.

computergeek

Programmer
May 23, 2001
193
CA
Hi,

I am trying to insert a link to another page within the Grid DTC (Design Time Control). This expression works:
=&quot;<A TITLE=&quot; + &quot;Forecast.View&quot; + &quot; HREF=Site.asp?SiteId=&quot; + [site_id] + &quot;>&quot; + [site_name] + &quot;</A>&quot;

I would like to embed a graphic (button) for them to click instead of the column value. When the first quote is reached the Grid DTC thinks that's the end of the entire string! How do you embed a string within a string?
=&quot;<A TITLE=&quot; + &quot;Forecast.View&quot; + &quot; HREF=Site.asp?SiteId=&quot; + [site_id] + &quot;><img src=&quot; 'test.gif'+ &quot;></A>&quot;

Please help... Thanks in advance for taking the time to look into this problem.

Computergeek
 
You may find it easier to call a server-side function (in VBScript or JScript) from the grid.

For example: In a server-side JavaScript block add:

function gridFormatGraphicLink(i_intSiteId, i_strSiteName)
{
return '<A TITLE=&quot;Forecast.View&quot; ' +
' HREF=&quot;Site.asp?SiteId=' + i_intSiteId +
'><img src=&quot;test.gif&quot; alt=&quot;' + i_strSiteName + '&quot;></A>';
}

You still need to take care of the single/double quotes - a JScript string can be bounded with either single or double quotes (thus making it easier than VB for strings). To include a quote within a string, you ESCAPE the quote character with a back-slash:

&quot;ollie's fish&quot;
'ollie\'s fish'
'he said &quot;hello&quot;'
&quot;he said \&quot;hello\&quot;&quot;

Now in your grid, just put:

=gridFormatGraphicLink([Site_Id], [Site_Name])

Note: I always put i_ prefix before function parameters to indicate input paramaters (o_ for output or io_ for two-way parameters). Its just habbit! For long functions it is handy as you always know where a variable came from. Module/Page scope variables can be prefixed with m_
(Content Management)
 
Hi Merlin,

Thanks again... you seem to answer alot of questions on this forum. I really appreciate your help!

Just curious, where do you live? I am from Calgary, Canada.

Computergeek
 
Near London, England ( I work in London ).

I visited Calgary in 1981 with the Scouts - Canadian Jamboree. There were 11,000 scouts from all over the world stuck up some mountain that they had to spray with mosquito killer because you breed such big bu&&ers there! I walked in the Calgary Parade - part of the Stampede show - carrying the Union Jack, so I got to see your beautiful city. I even stayed the night in a Mormon Church Sports Hall. The strongest memory of that week, though, was of the yellow-and-black school busses - hundreds of them, snaking up the mountain carrying all of these scouts from airports and other places.
We then flew to Gwelph(?) in Toronto and stayed on a farm.

We had a great time - you have some nice folks there. (Content Management)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top