Returns a client side Postback Event link (__doPostBack() call) that can be used to fire a server side event from client code.
A common way that this function would be called is from a Grid Column Expression. Here's an example:
<ww:wwWebDataGridColumn runat="server" ID="WwWebDataGridColumn1" Expression="HREF( this.Page.GetPostbackEventReference('Page','DeleteCompany',Trans(pk),.t.) ,[Delete])" HeaderText="Action" >
This code uses the HREF() expression to generate a hyperlink and the link itself is set by the GetbackEventReference method. The output from this function generates something like this:
Remember if you manually use __doPostback() from script code, you have to ensure that this.Page.RegisterPostbackScriptCode was called somewhere in your code to ensure the postback script is included in the page source.
Other ways to use this methodYou will frequently want to assign this method dynamically for navigation expressions. For example you might do the following in a Repeater:
<ww:wwWebImageButton runat="server" ID="btnDelete" Click="btnDelete_Click" ImageUrl="~/images/remove.gif" UrlControlSource="this.Page.GetPostbackEventReference('Page','btnDelete_Click',TRANS(pk),.T.)" />
You can then handle this event as follows inside of the page:
FUNCTION btnDelete_Click() *** Retrieve the event parameter (same as: Request.Form("__EventParameter") ) lcId = this.GetPostBackEventParameter() *** Do something with the value this.oEntry.Delete( VAL(lcId) ) ENDFUNC
The UniqueID of the control that is to be accessed.
As a special case you can acces the Page object with:
this allows you to directly fire events on the Page object which essentially allows you to fire custom events.
The event on that control to fire. Note this is a Control's event not the event that you have mapped onto the Page object (ie. Click rather than btnSubmit_Click)
An optional parameter that is to be passed to the server event. The parameter's value can be retrieved with:
Response is returned with string parameters set to single quotes (ie. 'value') - this may affect how you embed this value.
If you call this method or use __doPostBack("Page","Event") directly in your code without using a control that makes use of AutoPostback, make sure you call RegisterPostbackScriptCode() to force the __doPostBack() function into the page object.
See also:Class wwWebPage | wwWebPage::GetPostbackEventParameter | wwWebPage::RegisterPostbackScriptCode
Comment or report problem with topic