Sunday, 25 August 2013

Create enum list of stored images

Create enum list of stored images References I have an \'Images\' folder in the solution explorer. Can I create an enum list of all the images (& their paths). I want to add that list to a dropdown. For now I am doing this explicitly: private enum bgImages { BlueArt,GreenArt,StripeArt } protected void Page_Load(object sender, EventArgs e) { string[] Backgrounds = Enum.GetNames(typeof(bgImages)); ddlBackground.DataSource = Backgrounds; ddlBackground.DataBind(); } //.......... pnlImage.BackImageUrl=\"~/Images/\"+\"ddlBackground.SelectedItem.Text+\".jpg\";

No comments:

Post a Comment