Drop Down List Problem

Discussion in 'ASP .Net' started by newsgroups.jd@gmail.com, Mar 29, 2006.

  1. Guest

    Thanks for any advice, help in advance...

    I have 3 dropdownlist that populate based on choice in the previous
    (nested essentially)


    Problem is when I hit the back button and make a change in the second
    or thrid dropdownlist it does not always redirect to the correct
    site... What I really want to happen is
    if the back button is pushed then everything clears and all starts from

    first drop down list....

    I have tried this at the top...
    <%@ OutputCache Location="None" %>
    but this causes the page expire message when the back button is pushed
    which I dont want.

    I run this script at the top...
    <script runat="server">
    Public Sub _OnSelectedIndexChanged1(ByVal Sender As Object, ByVal e

    As EventArgs)
    If DropDownList1.SelectedValue = "Choose a Report Category"
    Then
    DropDownList2.Visible = False
    DropDownList3.Visible = False
    masterCalendar.Visible = False
    End If
    If DropDownList1.SelectedValue = "DailyReports"
    DropDownlist2.Visible = True
    masterCalendar.Visible = True
    DropDownList3.Visible = False
    End If
    If Not DropDownList1.SelectedValue = "Choose Category" And Not
    DropDownList1.SelectedValue = "DailyReports"
    DropDownlist2.Visible = True
    DropDownList3.Visible = False
    masterCalendar.Visible = False
    End If
    End Sub


    Public Sub _OnSelectedIndexChanged2(ByVal Sender As Object, ByVal e

    As EventArgs)
    If DropDownList2.SelectedValue = "Choose a Report" Or
    DropDownList2.SelectedValue = "Choose a Website" Then
    DropDownList3.Visible = False
    End If
    If DropDownList2.SelectedValue = "DailyReports1" Or
    DropDownList2.SelectedValue = "DailyReports2" Then
    DropDownList3.Visible = False
    masterCalendar.Visible = True
    End If
    If DropDownList2.SelectedValue = "ABC2006" Or
    DropDownList2.SelectedValue = "DEF2006" Then
    DropDownList3.Visible = True
    masterCalendar.Visible = False
    End If
    If InStr(DropDownList2.SelectedValue, "http://") Then
    Response.Redirect(DropDownList2.SelectedValue)
    End If
    End Sub


    Most of the drop downs are similar to below...
    <asp:DropDownList ID="DropDownList1" Runat="Server"
    AutoPostBack="True"
    DataSourceID="DDL1Source"
    DataTextField="category"
    DataValueField="categoryValue"

    OnSelectedIndexChanged="_OnSelectedIndexChanged1"
    </asp:DropDownList>

    Drop down list navigation is all working, just when the back button is
    pushed and you try to navigate to a different report, it redirects to
    the origional choice.... wierd

    Also if you see a better way to accomplish what I am doing here, please
    feel free to comment. I am always trying to learn more than I know,
    which is not much...

    JD
     
    , Mar 29, 2006
    #1
    1. Advertising

  2. Have you thought about something like the treeview control to acheive this
    instead of drop down lists?

    "" wrote:

    > Thanks for any advice, help in advance...
    >
    > I have 3 dropdownlist that populate based on choice in the previous
    > (nested essentially)
    >
    >
    > Problem is when I hit the back button and make a change in the second
    > or thrid dropdownlist it does not always redirect to the correct
    > site... What I really want to happen is
    > if the back button is pushed then everything clears and all starts from
    >
    > first drop down list....
    >
    > I have tried this at the top...
    > <%@ OutputCache Location="None" %>
    > but this causes the page expire message when the back button is pushed
    > which I dont want.
    >
    > I run this script at the top...
    > <script runat="server">
    > Public Sub _OnSelectedIndexChanged1(ByVal Sender As Object, ByVal e
    >
    > As EventArgs)
    > If DropDownList1.SelectedValue = "Choose a Report Category"
    > Then
    > DropDownList2.Visible = False
    > DropDownList3.Visible = False
    > masterCalendar.Visible = False
    > End If
    > If DropDownList1.SelectedValue = "DailyReports"
    > DropDownlist2.Visible = True
    > masterCalendar.Visible = True
    > DropDownList3.Visible = False
    > End If
    > If Not DropDownList1.SelectedValue = "Choose Category" And Not
    > DropDownList1.SelectedValue = "DailyReports"
    > DropDownlist2.Visible = True
    > DropDownList3.Visible = False
    > masterCalendar.Visible = False
    > End If
    > End Sub
    >
    >
    > Public Sub _OnSelectedIndexChanged2(ByVal Sender As Object, ByVal e
    >
    > As EventArgs)
    > If DropDownList2.SelectedValue = "Choose a Report" Or
    > DropDownList2.SelectedValue = "Choose a Website" Then
    > DropDownList3.Visible = False
    > End If
    > If DropDownList2.SelectedValue = "DailyReports1" Or
    > DropDownList2.SelectedValue = "DailyReports2" Then
    > DropDownList3.Visible = False
    > masterCalendar.Visible = True
    > End If
    > If DropDownList2.SelectedValue = "ABC2006" Or
    > DropDownList2.SelectedValue = "DEF2006" Then
    > DropDownList3.Visible = True
    > masterCalendar.Visible = False
    > End If
    > If InStr(DropDownList2.SelectedValue, "http://") Then
    > Response.Redirect(DropDownList2.SelectedValue)
    > End If
    > End Sub
    >
    >
    > Most of the drop downs are similar to below...
    > <asp:DropDownList ID="DropDownList1" Runat="Server"
    > AutoPostBack="True"
    > DataSourceID="DDL1Source"
    > DataTextField="category"
    > DataValueField="categoryValue"
    >
    > OnSelectedIndexChanged="_OnSelectedIndexChanged1"
    > </asp:DropDownList>
    >
    > Drop down list navigation is all working, just when the back button is
    > pushed and you try to navigate to a different report, it redirects to
    > the origional choice.... wierd
    >
    > Also if you see a better way to accomplish what I am doing here, please
    > feel free to comment. I am always trying to learn more than I know,
    > which is not much...
    >
    > JD
    >
    >
     
    =?Utf-8?B?Y2xpY2tvbg==?=, Mar 29, 2006
    #2
    1. Advertising

  3. Guest

    I had something similar to a treeview before, but with hundred of
    reports and probably 1000's eventually, the drop down list should
    provide faster navigation. I also built in a calendar control for the
    daily reports. Daily reports is selected from the dropdownlist1 and
    type of daily from dropdownlist2, the calendar appears, date is
    selected and redirect to that daily report.

    My two main concerns are, is there a better way to code my solution and
    two, how do I resolve the problem with hitting the back button?

    Thanks!!

    JD
     
    , Mar 29, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SirPoonga
    Replies:
    2
    Views:
    821
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,076
    weiwei
    Jan 5, 2007
  3. msimmons
    Replies:
    0
    Views:
    551
    msimmons
    Jul 16, 2009
  4. Replies:
    5
    Views:
    318
  5. Replies:
    3
    Views:
    324
Loading...

Share This Page