Reputation: 1070
I'm getting data from a database, and one of them its a link to a picture somewhere in the web. I want the user to click on that link, and then with querystring, to pass all the data to another page.
I tried to do this :
<% foreach (System.Data.DataRow dataRow in DT.Rows ) { %>
<% = dataRow["Title"].ToString() %>
<% string QueryString= Request.QueryString.ToString(); %>
<a href="<%("MoviesInfo.aspx?"+ QueryString) %>"><img src="<% = dataRow["Descreption"].ToString() %>" width="30%" height="30%" /></a>
<% = dataRow["Ganere"].ToString() %>
<% } %>
but it didnt work out well... what could be the problem?
Thanks!
Upvotes: 1
Views: 858
Reputation: 4413
There are 2 problems with your code.
1) You're setting QueryString to be the current Request's query string. I'm pretty sure you want this be data on the current row?
<% string QueryString= dataRow["Movie"].ToString(); %>
2) The href should be built using <%=
instead of <%
:
<a href="<%= ("MoviesInfo.aspx?"+ QueryString) %>">
Upvotes: 1