I have a simple cfgrid that's displaying my ids. I want the id to be a link to a new page, passing a url parameter of "myID" with the id value.
I've tried this code:
<cfgrid name="myGrid" query="myQuery" format="html">
<cfgridcolumn name="myID" href="mynewpage.cfm" />
</cfgrid>
But this takes me to the url "mynewpage.cfm?hrefkey=111". What I really want is "mynewpage.cfm?myID=111". Is there any way to specify what the name of the url parameter should be?
I've also tried:
<cfgrid name="myGrid" query="myQuery" format="html">
<cfgridcolumn name="myID" href="mynewpage.cfm?myID=#myID#" />
</cfgrid>
But then I get the error "myID is not defined
". Is there any way to reference query field values from within a cfgridcolumn tag?
UPDATE:
Another thing I've tried - building the string in the sql query so that I return a column called myURL
with a value of "mynewpage.cfm?myID=111", and then using that column for the href attribute:
<cfgrid name="myGrid" query="myQuery" format="html">
<cfgridcolumn name="myID" href="#myURL#" />
</cfgrid>
According to the coldfusion documentation you should be able to do this:
href - URL or query column name that contains a URL to hyperlink each grid column with.
(italics mine)
But I get the error "myURL is not defined
". How do I set the href to a column rather than a literal url value?