this is definitely an easy question but I still don't know what exactly it is for. Can anybody tell me what ImageUrl='<%# Eval("FileName") %>' means? I still don't get the idea why we need to include %#.
-
3You shouldn't say "sorry", we all here for learning.Soner Gönül– Soner Gönül2012-12-15 09:28:11 +00:00Commented Dec 15, 2012 at 9:28
-
It's a database fieldname from which the URL (or source of image) will be set.Dev– Dev2012-12-15 09:38:43 +00:00Commented Dec 15, 2012 at 9:38
4 Answers
<%# Eval("FileName") %> is used in the context of binding data from a collection to a control. Probably the value for the imageurl is coming from a property of an object in the collection
For example, List<Photo> where Photo has a property of FileName. If you are binding that to a gridview, a repeater, etc, you'll access that property for each item in the collection when binding to such controls
1 Comment
in this Line...
ImageUrl='<%# Eval("FileName") %>'
ImageURL the attribute of your asp:ImageButton control that is used to specify the Url of the Image File to be Used
Code between '<% and %>' tags are writtent to be Executed on the Server
'#' is used to specify that the result of server side execution will be bound hear
Eval KeyWord is Used To Evaluate the perticular Column Value (that you specify ("--hear--")) from The DataSourse
Comments
Here we have used the Eval function which is used for one way databinding. FileName is the field name you are associating. Anything that's written inside <%# %> is parsed by asp.net engine before generating the webpage source which is pure client side script and html tags. So Eval function is executed at server end by ASP.net engine.