javascript - How to bind Request.QueryString[""] to Eval() in ASP.NET - Stack Overflow

ImageUrl='<%#Eval("Name","..Master PagesDisasterImages") %>'+�

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. The problem is now I want to get the folder name in the QueryString. How can I do this? Above is the code I have tried without achieving the desired oute...

Any help would appreciated.

Thank you!

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. The problem is now I want to get the folder name in the QueryString. How can I do this? Above is the code I have tried without achieving the desired oute...

Any help would appreciated.

Thank you!

Share Improve this question edited Oct 13, 2016 at 21:12 BangEqualsDestructor 651 silver badge11 bronze badges asked Jun 17, 2010 at 8:33 chamarachamara 12.7k34 gold badges138 silver badges214 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 4

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745047287a4608177.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信