The following tips and best practices should be considered for all portlets that use the .NET Web Control Consumer.
<asp:Button id="Execute_<%= portlet_id %>" runat="server" Text="Test"></asp:Button>The best way to append the portlet ID to the name is programmatically. To do this, declare the control in the ASPX page with a standard name, and then modify the ID property from the code behind page. You can access the actual controls using the System.Web.UI.Page Controls property or the System.Web.UI.Page FindControl(string ControlName) method.
protected override void OnPreRender(EventArgs e) { base.OnPreRender (e); FindControl("MyControl").ID += portletID; }
The standard method of posting to the target page and redirecting back to the portal page using the IDK is also possible, however this is generally slower (performs a post and a redirect), less aesthetically pleasing (refreshes the whole page), and will lose the state of the page if handled by the client (__VIEWSTATE will be lost).
<pt:namespace pt:token="$$PORTLET_ID$$" xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/> function alertMe_$$PORTLET_ID$$, () { alert("Portlet Rendering!"); } alertMe_$$PORTLET_ID$$;//call the first time the portlet is loadedThen register for the event in the code behind page:
private void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) RegisterClientScriptBlock("rerender", "<script language=\"javascript\">document.PCC.RegisterForWindowEvent('rerender.$$PORTLET_ID$$', alertMe_$$PORTLET_ID$$)</script>"); }In the example above, $$PORTLET_ID$$ is replaced by the portlet ID using the pt:token tag. You can also use the Oracle WebCenter Interaction Development Kit (IDK) to extract the portlet ID from the request. See the Oracle WebCenter Interaction Web Service Development Guide for more information on adaptive tags.
Context.Items["PTWC:EnableFilter"] = false;This will disable filtering for the current request only.