So in one of my tables, there lies an image file location. I'm grabbing that information to be displayed in an asp:dropdownlist, however, I want just the name of the image to be displayed. How/Where would I parse the filename out of it. Also, is there a built in method for grabbing the filename?
EDIT::
http://msdn.microsoft.com/en-us/library/bb397663.aspx
instead of:
var oData = from c in oDb.CustomerImages
where c.CustomerID == CustomerID &&
c.CustomerNumber == CustomerNumber &&
c.CategoryID == CategoryID
orderby c.ID
select new { Path.GetFileName(c.Location), c.ID };
just set it to a variable, and then set you set your dropdownlist.DataTextField = to that variable's name:
solution:
var oData = from c in oDb.CustomerImages
where c.CustomerID == CustomerID &&
c.CustomerNumber == CustomerNumber &&
c.CategoryID == CategoryID
orderby c.ID
select new { Location = Path.GetFileName(c.Location), c.ID };
return oData;
//elsewhere ...
dropdownlist.DataTextField = "Location";