Version 2, last updated by judah at September 12, 2009 21:18 UTC

Adding Parameters to the hyperlink

You can specify parameters on a hyperlink. Parameters allow you to specify detail to the state you are on or navigating too. We add these to the URL so that we can bookmark and restore the state.

		<controls:TextLink text="Products" id="productsLink1" hyperlink="products?productID=50"/>

In this example we are specifying the products state as the destination state and the productID property with a value of 50. We can use a parameter handler to specify what to do with parameters.

 

		<managers:handlers>
<handlers:ParameterHandler id="parameterHandler1" parameter="productID" isNotBlank="true">
<handlers:actions>
<behaviors:SetProperty property="productID" value="{parameterHandler1.value}"/>
</handlers:actions>
</handlers:ParameterHandler>
</managers:handlers>

 

In this example we are setting a property named, "productID" to the value of the parameter. Since we haven't specified the target of the SetProperty instruction the target is the Application.

 

We can specify multiple parameters by separating them wih a semicolon.

		<controls:TextLink text="Products" id="productsLink1" hyperlink="products?productID=50;session=123a7b7ced7fb42f"/>

 

Note: When you add parameters in the hyperlink these get retranslated in the browser URL to include the state and anchor. For example, if you specify this hyperlink, "state1@anchor1?parameter1=value1;parameter2=value2" then this will get translated to this in the browser address bar, "http://mysite.com/mypage.html#s=state1;a=anchor1;parameter1=value1;parameter2=value2". The state and the anchor are translated using a shortened alias.