views:

40

answers:

1
ImageUrl='<%#Eval("Name","../Master Pages/DisasterImages/") %>'+'<%#Eval("Request.QueryString["DisID"].ToString()/{0}") %>'

DisID is a folder name.

What i want is to display the images in the directory. I have done it using a repeater control.Problem is now i want to get the folder name in the Query String.How can i do this.Above is the code that i have tried and it doesn't seems to be working....

Any help would appreciated

Thank you!

+2  A: 

use <%= instead of <%#. Example:

<%= Request.QueryString["DisID"] %>

I have noticed another issue with your code, you need to be careful when using quotes inside a string. You need to escape them. Therefore

"Request.QueryString["DisID"].ToString()/{0}"

should look like this

"Request.QueryString[\"DisID\"].ToString()/{0}"

Notice the backslash that serves for escaping characters.

Genady Sergeev
hi Genady, the path i want to access is ../Master Pages/DisasterImages/XXX/{0}. XXX is the name i want to get from the QueryString.Still i haven't got it working.Following is what i have tried this time. ImageUrl='<%#Eval("Name","../Master Pages/DisasterImages/") %>'+'<%=Request.QueryString[\"DisID\"].ToString()/{0} %>'
chamara
You need not to call ToString when retrieving query string params since they are strings already. Are there any errors when the code is executed, why do you need the {0} string. What happens if you remove that part? Please keep in mind that the <%# expressions are only evaluated when one call DataBind on the respective control.
Genady Sergeev