Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Drop Down List Problem

Reply
Thread Tools

Drop Down List Problem

 
 
newsgroups.jd@gmail.com
Guest
Posts: n/a
 
      03-29-2006
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...
<aspropDownList ID="DropDownList1" Runat="Server"
AutoPostBack="True"
DataSourceID="DDL1Source"
DataTextField="category"
DataValueField="categoryValue"

OnSelectedIndexChanged="_OnSelectedIndexChanged1"
</aspropDownList>

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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Y2xpY2tvbg==?=
Guest
Posts: n/a
 
      03-29-2006
Have you thought about something like the treeview control to acheive this
instead of drop down lists?

"(E-Mail Removed)" 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...
> <aspropDownList ID="DropDownList1" Runat="Server"
> AutoPostBack="True"
> DataSourceID="DDL1Source"
> DataTextField="category"
> DataValueField="categoryValue"
>
> OnSelectedIndexChanged="_OnSelectedIndexChanged1"
> </aspropDownList>
>
> 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
>
>

 
Reply With Quote
 
 
 
 
newsgroups.jd@gmail.com
Guest
Posts: n/a
 
      03-29-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
retrive preselected value in second drop down list from the first drop down list weiwei ASP .Net 0 01-05-2007 07:29 PM
Multiple select drop down poplulating sub drop down scott@dettcom.com Javascript 3 11-09-2006 07:50 PM
Auto Drop down a Drop Down List xxbmichae1@supergambler.com Javascript 5 11-23-2005 01:35 AM
New to .NET, can I have one drop down box control the data of another drop down box using a database? SirPoonga ASP .Net 2 01-07-2005 10:44 PM



Advertisments