Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9104695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:55:36+00:00 2026-06-17T01:55:36+00:00

Load multiple Images dynamically from folder based on dropdown list selected option in asp.net.

  • 0

Load multiple Images dynamically from folder based on dropdown list selected option in asp.net.
Can anyone help me with this to implement in visual studio?
this is the code i tried, help me with better option or modify this, also i need to bind the image output to image button control as slideshow.

 <script type="text/javascript">
   function new1(city) {
      switch (city) {
           case "Patna":
               var imlocation = "Patna/";
               var currentdate = 0;
               var image_number = 0;
               function ImageArray(n) {
                   this.length = n;
                   for (var i = 1; i <= n; i++) {
                       this[i] = ' '
                   }
               }
               image = new ImageArray(2)
               image[0] = '2.jpg'
               image[1] = '3.jpg'
               var rand = 60 / image.length
               function randomimage() {
                   currentdate = new Date()
                   image_number = currentdate.getSeconds()
                   image_number = Math.floor(image_number / rand)
                   return (image[image_number])
               }
                                  document.write("<img src='" + imlocation + randomimage() + "'>");

           case "Bhopal":
               var imlocation1 = "Bhopal/";
               var currentdate1 = 0;
               var image_number1 = 0;
               function ImageArray1(n) {
                   this.length = n;
                   for (var i = 1; i <= n; i++) {
                       this[i] = ' '
                   }
               }
               image1 = new ImageArray1(3)
               image1[0] = '2.jpg'
               image1[1] = '4.jpg'
               image1[2] = '1.jpg'
               var rand1 = 100/ image1.length
               function randomimage1() {
                   currentdate1 = new Date()
                   image_number1 = currentdate1.getSeconds()
                   image_number1 = Math.floor(image_number1 / rand1)
                   return (image1[image_number1])
               }
               document.write("<img src='" + imlocation1 + randomimage1() + "'>");

       }
   }

<asp:DropDownList ID="DropDownList1" runat="server" onchange="new1(this.value)"
                DataSourceID="SqlDataSource1" DataTextField="City" DataValueField="City" 
                onselectedindexchanged="DropDownList1_SelectedIndexChanged" 
                AutoPostBack="True" >
            </asp:DropDownList>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:55:38+00:00Added an answer on June 17, 2026 at 1:55 am

    finally i am itself found an answer for this, using ajax slideshow extender use the code below in webservice.

    [System.Web.Script.Services.ScriptService]
    public class WebService1 : System.Web.Services.WebService
    {
        [System.Web.Services.WebMethod()]
        [System.Web.Script.Services.ScriptMethod]
        public AjaxControlToolkit.Slide[] GetSlides(string contextKey)
        {
    
            string[] imagenames = System.IO.Directory.GetFiles(HttpContext.Current.Server.MapPath("~/" + contextKey ));
            AjaxControlToolkit.Slide[] photos = new AjaxControlToolkit.Slide[imagenames.Length];
            for (int i = 0; i < imagenames.Length; i++)
            {
                string[] file = imagenames[i].Split('\\');
                photos[i] = new AjaxControlToolkit.Slide(contextKey + "/" + file[file.Length - 1], file[file.Length - 1], "");
            }
            return photos;
    
        }
    
      }
    

    in slideshow extender

     <asp:SlideShowExtender ID="SlideShowExtender1" TargetControlID="Image1"     SlideShowServiceMethod="GetSlides" SlideShowServicePath="~/WebService1.asmx" Loop="true" runat="server"  UseContextKey="true" 
        AutoPlay="True" BehaviorID="b1" >        
    </asp:SlideShowExtender>
    

    finally in page_load

     if (Page.IsPostBack)
     {
         SlideShowExtender1.ContextKey = DropDownList1.SelectedValue;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can you help me to load or read multiple images from a file. Because
Could anyone suggest to me how to load multiple images in one tab and
I want to load multiple images when my app starts from a website (i.e.
what is best method to store multiple images (layers) , so user can read(load)
I would like to load and draw multiple/all images from a directory in Processing.
I am attempting to load multiple images in AS3 and I'm exploring different options
I am trying to load multiple images that corresponds to my node when I
I am using this class to load multiple images synchronously. Somehow the loader doesn't
I am trying to load multiple elements with the same name from XML into
I want to load multiple images inside a wrappanel, for each image I show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.