title: asp:GridView HYPERLINKFIELD - asp code inside datanavigateurlformatstring
body: <p>I have a page to search products by their name.
  In many pages I work with product codes. If the user does not know the product code, I let him go to this page, search by name, and then select one of the results and get back to the page he came from.</p>
  
  <p>In the results of the search by name I set an HyperLinkField that will redirect to a certain page , with a paramter of the product code.</p>
  
  <p>My code is like this:</p>
  
  <pre><code> &lt;asp:GridView ID="GridView1" Runat="server" 
    DataSource='&lt;%# GetData(pName.Text) %&gt;' AutoGenerateColumns="False"&gt;
      &lt;Columns&gt;
          &lt;asp:BoundField DataField="Name"&gt;
              &lt;ItemStyle HorizontalAlign="Center" 
                VerticalAlign="Middle"&gt;&lt;/ItemStyle&gt;
          &lt;/asp:BoundField&gt;
          &lt;asp:BoundField  DataField="Code"&gt;&lt;/asp:BoundField&gt;
          &lt;asp:ImageField ControlStyle-Width="150px"  ControlStyle-Height="150px" DataImageUrlField="PictureURL" &gt;&lt;/asp:ImageField&gt;
          &lt;ASP:HYPERLINKFIELD text="&gt;&gt;" datanavigateurlfields="Code"  datanavigateurlformatstring="priceUpdater.aspx?ProductCode={0}"&gt;&lt;/ASP:HYPERLINKFIELD&gt; 
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Where GetData is a function that returns an object of type Product with the fields, name,Code,image etc.</p>
  
  <p>As you can see, this link in the HYPERLINKFIELD will redirect to a page called priceUpdater with the parameter of the product code.</p>
  
  <p>I want this page to be dynamic. 
  I have tried to add a paramter to the search page like this</p>
  
  <pre><code> &lt;%string pageRequested = Page.Request.QueryString["SearchScreen"];%&gt;
  </code></pre>
  
  <p>and now im trying to use the HYPERLINK like this:</p>
  
  <pre><code>&lt;ASP:HYPERLINKFIELD text="&gt;&gt;" datanavigateurlfields="Code"  datanavigateurlformatstring="&lt;%=pageRequested%&gt;.aspx?ProductCode={0}"&gt;&lt;/ASP:HYPERLINKFIELD&gt; 
  </code></pre>
  
  <p>But the page that the link reffers to is just as plain text as wrriten (<a href="http://mysite.com/%3C%=pageRequested%" rel="nofollow">http://mysite.com/%3C%=pageRequested%</a>>.aspx?ProductCode=2450)</p>
  
  <p>How can I make this work?</p>
  
  <p>Thank you!</p>