Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the following asp cod:
ASP.NET
<asp:Repeater ID="rpt1" runat="server" onitemdatabound="rpt1_ItemDataBound">
  <ItemTemplate>
    <div style="float:left; padding-removed4px"><%# Eval("Name") %>  </div>
     <div style="float:left; padding-removed4px"><%# Eval("CollectionType")%></div>
     <div style="float:right">
     <a href="AddItem.aspx?c=<%# Eval("CollectionID") %>">[edit item]</a>
     </div>
     <br />
  </ItemTemplate>
  </asp:Repeater>


Can you explain please what is occurring in this asp row?
HTML
<a href="AddItem.aspx?c=<%# Eval("CollectionID") %>">[edit item]</a>





Thank you in advance.
Posted

1 solution

Above you have created a link to AddItem.aspx.

After the '?' you have defined a parameter. In this case you have a parameter 'c'.

To set the parameter you follow the c with '='.

Finally you have set the parameter 'c' from the datasource by calling <% Eval("CollectionID") %>.

If you are having problems with this passing the parameter value try changing the opening and closing double quotes to single quotes.

<a href="/KB/answers/AddItem.aspx"?c=<% Eval("CollectionID") %>">[edit item]</a> to:

<a href="/KB/answers/AddItem.aspx"?c=<% Eval("CollectionID") %>'>[edit item]</a>

Now anytime you click the link in the row it will redirect you to AddItem.aspx and also pass through the CollectionID parameter.

Is this helpful?
 
Share this answer
 
Comments
Mich_90 8-Jan-12 14:52pm    
Yes,thank u McGann!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900