I want to retrieve the "name" (similer to retrieving "image" from handler).
Will you please write the code which wuote you are talking about?
By the way I have did all try by changing the quotes. Nothing have been changed.
Hi chamansaini,
I'm not sure if I understand you exactly. Is the http handler "NameShow.ashx?id=xxx" within the same web application as your web page (in which your repeater is added)? If it is, why not directly writing a helper method to retrieve the name (maybe from database)
by a given id info? The following expression will not work:
<%#""NameShow.ashx?id="+Eval("id") %>
because the ASP.NET runtime will only evaluate the C# expression and output the plain text info (the url in this case here) in the respones html. If you want to let it access the HTTP handler's url and retrieve the response "name" field back, you need write
your own funciton (in page class) to do it. For exampmle, you can write a helper function in page's code behind which use HttpWebRequest class to access the httphandler (with id parameterss) and parse the name field from the response content:
#HttpWebRequest Class
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx
#Retrieving HTTP content in .NET
http://www.west-wind.com/presentations/dotnetWebRequest/dotnetWebRequest.htm
Then, your <%# %> expression can invoke the helper method. But having such a helper method invoked repeatedly for each repeater item will significantly impact the page's response performance (it spends time for each WebRequest operation to finish). Therefore,
I'd suggest you reconsider the current design to see if we can implement the same feature with different approaches.
沒有留言:
張貼留言