Hello,
Please forgive my basic questions but can we run a Foxpro function by clicking on a field on HTMLDataGrid without launching to any page?
I know we can call functions while we're creating the grid, like: loColumn = loConfig.AddColumn([Process.LinkAlbum()],"Album")
but I need to do something behind the scene by clicking on the fields.
Thanks,
Kathy
I know you're coming from Web Control framework so you expect something like a button click that fires an event on the server, right?
This sort of thing you typically handled with a link (I think that's what you're referring to with Process.LinkAlbum()
) that just fires another request with an id. What's different there is that the state of change isn't automatically reflected back into the original page. You can however, link or post back to the same page that hosts the link, so when you process your server code you can re-render the grid when you are done. In the process method you can have a CASE
statement:
FUNCTION InvoiceDisplay
DO CASE
CASE action="recalculateitems"
this.RecalculateLineItem()
CASE action="deleteitem"
loBusItem.Delete(lcId)
...
ENDIF
*** Page State Configuration
loBusInvoice.Load(lcInvId)
Response.ExpandScript()
You can either do that processing inline, or offload to other methods, or if necessary even entire external classes or business objects.
+++ Rick ---
Thank you so much Rick.
Just need a quick confirmation.
I need to run a function prior to launching another page and since I don't need the reflection on the current page and I'd like to hide the query string and parameters as much as possible, I was thinking I might be able to call process methods the way we can do during creating the data grid like: loColumn = loConfig.AddColumn([Process.LinkAlbum()],"Album")
but now I assume it still has to be done by query string. Is that right?
So I assume I have to use HREF() or HTMLlink() to call the same page and send the "action" which could be the id of what's been clicked and then handle the page considering what's been sent through query string.
And I assume I cannot use something like loColumn = loConfig.AddColumn(HREF([same_page.wwd],[Run_myCode],[ onclick='<%= myCode() %>';' ]))
Would you please correct me if I'm wrong?
Thanks again.
Correct. You can't just call another method, you have to link to something else. The Web Control framework made it seem like you could just 'call a method' from the button, but really it was POSTing back to the same request that you were currently running.
You can still do that and in fact that might be the way to do this. You basically call the same URL you are on (say your're on invoice.wcs
then call back with invoice.wcs?action=add
or invoice.wcs?action=delete
etc.). This way you can kind of do the same thing that the Web Control framework did although you have to pass state back to the request (ie. Ids and anything saved on the form).
+++ Rick ---