Broodmdh
August 19th, 2005, 10:47 AM
I am populating a dropdownlist with a listing of subdirectories. When the user selects a dir from the list, I want the page to refresh. When the page is created (or refreshed), action will be taken based on the contents of the selected dir (or default dir if not post back). I am finding, however, that even when a user makes a selection from the dropdownlist, this change is not reflected upon postback. My code is as follows:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strDir = Directory.GetDirectories("c:\inetpub\wwwroot\site2\Images", "*")
lstDir.DataSource = strDir
lstDir.DataBind()
lstDir.AutoPostBack = True
PictureGallery()
End Sub
Private Sub PictureGallery()
strImageFiles = Directory.GetFiles(lstDir.SelectedIndex.Text, "*.jpg")
cmdNext.Text = "Next"
cmdNext.Width = Unit.Pixel(75)
cmdPrevious.Text = "Previous"
cmdPrevious.Width = Unit.Pixel(75)
lblInstruct.Text = lstDir.SelectedIndex 'This always outputs 0 regardless of which entry is selected in the list
End Sub
Any thoughts?
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strDir = Directory.GetDirectories("c:\inetpub\wwwroot\site2\Images", "*")
lstDir.DataSource = strDir
lstDir.DataBind()
lstDir.AutoPostBack = True
PictureGallery()
End Sub
Private Sub PictureGallery()
strImageFiles = Directory.GetFiles(lstDir.SelectedIndex.Text, "*.jpg")
cmdNext.Text = "Next"
cmdNext.Width = Unit.Pixel(75)
cmdPrevious.Text = "Previous"
cmdPrevious.Width = Unit.Pixel(75)
lblInstruct.Text = lstDir.SelectedIndex 'This always outputs 0 regardless of which entry is selected in the list
End Sub
Any thoughts?