473,805 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading a listbox from a Dropdownlist

gv
Ok,

Hi all, new to asp.net. Simple question

with web forms

I have a Dropdownlist and a listbox, I want to click on and item in the
dropdownlist and show items in listbox. that simple

I have this: I have two items in Dropdownlist. The Reportlist doesn't show
the items ?

I tried to set the Autopostback to true. This does work but, the page
flickers

Private Sub Databaselist_Se lectedIndexChan ged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
Databaselist.Se lectedIndexChan ged
If Databaselist.Se lectedValue = "Test1" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test1Tot als by Date Range")
ReportList.Item s.Add("Test1Tot als by name and Date Range")

ElseIf Databaselist.Se lectedValue = "Test2" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test2Tot als by Date Range")
ReportList.Item s.Add("Test2 Totals by name and Date Range")

End If
End Sub
Nov 19 '05 #1
8 1496
are you clearing them/setting them in the page_load? You may be blanking
them out each time.
look at the IsPostBack() to differentiate

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"gv" <vi*****@musc.e du> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
Ok,

Hi all, new to asp.net. Simple question

with web forms

I have a Dropdownlist and a listbox, I want to click on and item in the
dropdownlist and show items in listbox. that simple

I have this: I have two items in Dropdownlist. The Reportlist doesn't show
the items ?

I tried to set the Autopostback to true. This does work but, the page
flickers

Private Sub Databaselist_Se lectedIndexChan ged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
Databaselist.Se lectedIndexChan ged
If Databaselist.Se lectedValue = "Test1" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test1Tot als by Date Range")
ReportList.Item s.Add("Test1Tot als by name and Date Range")

ElseIf Databaselist.Se lectedValue = "Test2" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test2Tot als by Date Range")
ReportList.Item s.Add("Test2 Totals by name and Date Range")

End If
End Sub

Nov 19 '05 #2
Gv:
It works fine for me. Are you sure you have the AutoPostBack=tr ue for the
dropdownlist?

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.e du> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
Ok,

Hi all, new to asp.net. Simple question

with web forms

I have a Dropdownlist and a listbox, I want to click on and item in the
dropdownlist and show items in listbox. that simple

I have this: I have two items in Dropdownlist. The Reportlist doesn't show
the items ?

I tried to set the Autopostback to true. This does work but, the page
flickers

Private Sub Databaselist_Se lectedIndexChan ged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
Databaselist.Se lectedIndexChan ged
If Databaselist.Se lectedValue = "Test1" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test1Tot als by Date Range")
ReportList.Item s.Add("Test1Tot als by name and Date Range")

ElseIf Databaselist.Se lectedValue = "Test2" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test2Tot als by Date Range")
ReportList.Item s.Add("Test2 Totals by name and Date Range")

End If
End Sub

Nov 19 '05 #3
gv
Thanks for your help, I'm only clearing the listbox before I load the new
values based on what is selected in the dropdownlist.
The values load fine when the page first opens. Not when the
controls SelectedIndexCh anged event fires.

GV


"Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
news:uv******** ******@TK2MSFTN GP11.phx.gbl...
are you clearing them/setting them in the page_load? You may be blanking
them out each time.
look at the IsPostBack() to differentiate

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"gv" <vi*****@musc.e du> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
Ok,

Hi all, new to asp.net. Simple question

with web forms

I have a Dropdownlist and a listbox, I want to click on and item in the
dropdownlist and show items in listbox. that simple

I have this: I have two items in Dropdownlist. The Reportlist doesn't
show the items ?

I tried to set the Autopostback to true. This does work but, the page
flickers

Private Sub Databaselist_Se lectedIndexChan ged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
Databaselist.Se lectedIndexChan ged
If Databaselist.Se lectedValue = "Test1" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test1Tot als by Date Range")
ReportList.Item s.Add("Test1Tot als by name and Date Range")

ElseIf Databaselist.Se lectedValue = "Test2" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test2Tot als by Date Range")
ReportList.Item s.Add("Test2 Totals by name and Date Range")

End If
End Sub


Nov 19 '05 #4
gv
If I do that, it works fine like I said but, flickers?

I don't want it to flicker when I do this.

thanks
gv
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:e5******** ******@TK2MSFTN GP09.phx.gbl...
Gv:
It works fine for me. Are you sure you have the AutoPostBack=tr ue for the
dropdownlist?

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.e du> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
Ok,

Hi all, new to asp.net. Simple question

with web forms

I have a Dropdownlist and a listbox, I want to click on and item in the
dropdownlist and show items in listbox. that simple

I have this: I have two items in Dropdownlist. The Reportlist doesn't
show
the items ?

I tried to set the Autopostback to true. This does work but, the page
flickers

Private Sub Databaselist_Se lectedIndexChan ged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
Databaselist.Se lectedIndexChan ged
If Databaselist.Se lectedValue = "Test1" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test1Tot als by Date Range")
ReportList.Item s.Add("Test1Tot als by name and Date Range")

ElseIf Databaselist.Se lectedValue = "Test2" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test2Tot als by Date Range")
ReportList.Item s.Add("Test2 Totals by name and Date Range")

End If
End Sub


Nov 19 '05 #5
Geez..so much for reading through everything....i didn't catch that at all.

One solution is to do everything on the client-side...which has its up and
down side.

Another one is to turn on SmartNavigation which only works in IE and some
people have a lot of problems with it. Try putting SmartNaviation= true in
the <%@ Page directive...
You should check out:
http://weblogs.asp.net/ksamaschke/ar...4/27/6085.aspx or just do a
google search for SmartNavigation

Other that that, it's the nature of doing web programming...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.e du> wrote in message
news:Ox******** ******@TK2MSFTN GP09.phx.gbl...
If I do that, it works fine like I said but, flickers?

I don't want it to flicker when I do this.

thanks
gv
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:e5******** ******@TK2MSFTN GP09.phx.gbl...
Gv:
It works fine for me. Are you sure you have the AutoPostBack=tr ue for the dropdownlist?

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.e du> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
Ok,

Hi all, new to asp.net. Simple question

with web forms

I have a Dropdownlist and a listbox, I want to click on and item in the
dropdownlist and show items in listbox. that simple

I have this: I have two items in Dropdownlist. The Reportlist doesn't
show
the items ?

I tried to set the Autopostback to true. This does work but, the page
flickers

Private Sub Databaselist_Se lectedIndexChan ged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
Databaselist.Se lectedIndexChan ged
If Databaselist.Se lectedValue = "Test1" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test1Tot als by Date Range")
ReportList.Item s.Add("Test1Tot als by name and Date Range")

ElseIf Databaselist.Se lectedValue = "Test2" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test2Tot als by Date Range")
ReportList.Item s.Add("Test2 Totals by name and Date Range")

End If
End Sub



Nov 19 '05 #6
you cant avoid the flicker. That is the page making a round trip to the
server, its unavoidable unless you do it all with clientside code

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"gv" <vi*****@musc.e du> wrote in message
news:Ox******** ******@TK2MSFTN GP09.phx.gbl...
If I do that, it works fine like I said but, flickers?

I don't want it to flicker when I do this.

thanks
gv
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:e5******** ******@TK2MSFTN GP09.phx.gbl...
Gv:
It works fine for me. Are you sure you have the AutoPostBack=tr ue for
the
dropdownlist?

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.e du> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
Ok,

Hi all, new to asp.net. Simple question

with web forms

I have a Dropdownlist and a listbox, I want to click on and item in the
dropdownlist and show items in listbox. that simple

I have this: I have two items in Dropdownlist. The Reportlist doesn't
show
the items ?

I tried to set the Autopostback to true. This does work but, the page
flickers

Private Sub Databaselist_Se lectedIndexChan ged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
Databaselist.Se lectedIndexChan ged
If Databaselist.Se lectedValue = "Test1" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test1Tot als by Date Range")
ReportList.Item s.Add("Test1Tot als by name and Date Range")

ElseIf Databaselist.Se lectedValue = "Test2" Then

ReportList.Item s.Clear()
ReportList.Item s.Add("Test2Tot als by Date Range")
ReportList.Item s.Add("Test2 Totals by name and Date Range")

End If
End Sub



Nov 19 '05 #7
gv
How would I do this part on the client side?

SmartNavigation didn't help.

thanks
Gerry
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:eS******** ******@TK2MSFTN GP11.phx.gbl...
Geez..so much for reading through everything....i didn't catch that at
all.

One solution is to do everything on the client-side...which has its up and
down side.

Another one is to turn on SmartNavigation which only works in IE and some
people have a lot of problems with it. Try putting SmartNaviation= true
in
the <%@ Page directive...
You should check out:
http://weblogs.asp.net/ksamaschke/ar...4/27/6085.aspx or just do
a
google search for SmartNavigation

Other that that, it's the nature of doing web programming...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.e du> wrote in message
news:Ox******** ******@TK2MSFTN GP09.phx.gbl...
If I do that, it works fine like I said but, flickers?

I don't want it to flicker when I do this.

thanks
gv
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:e5******** ******@TK2MSFTN GP09.phx.gbl...
> Gv:
> It works fine for me. Are you sure you have the AutoPostBack=tr ue for the > dropdownlist?
>
> karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "gv" <vi*****@musc.e du> wrote in message
> news:%2******** **********@TK2M SFTNGP12.phx.gb l...
>> Ok,
>>
>> Hi all, new to asp.net. Simple question
>>
>> with web forms
>>
>> I have a Dropdownlist and a listbox, I want to click on and item in
>> the
>> dropdownlist and show items in listbox. that simple
>>
>> I have this: I have two items in Dropdownlist. The Reportlist doesn't
>> show
>> the items ?
>>
>> I tried to set the Autopostback to true. This does work but, the page
>> flickers
>>
>> Private Sub Databaselist_Se lectedIndexChan ged(ByVal sender As
>> System.Object, ByVal e As System.EventArg s) Handles
>> Databaselist.Se lectedIndexChan ged
>> If Databaselist.Se lectedValue = "Test1" Then
>>
>> ReportList.Item s.Clear()
>> ReportList.Item s.Add("Test1Tot als by Date Range")
>> ReportList.Item s.Add("Test1Tot als by name and Date Range")
>>
>> ElseIf Databaselist.Se lectedValue = "Test2" Then
>>
>> ReportList.Item s.Clear()
>> ReportList.Item s.Add("Test2Tot als by Date Range")
>> ReportList.Item s.Add("Test2 Totals by name and Date
>> Range")
>>
>> End If
>> End Sub
>>
>>
>
>



Nov 19 '05 #8
GV:
There's no magic bullet to achieve this...it involves knowing a lot about
javascript, cross browser issues and using whatever ASP.Net offers to make
it easier (which really isn't too much, sadly).

One slightly clean solution is outlined here:
http://www.15seconds.com/issue/010205.htm

hope this sends you in the right direction.

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.e du> wrote in message
news:O$******** ******@TK2MSFTN GP09.phx.gbl...
How would I do this part on the client side?

SmartNavigation didn't help.

thanks
Gerry
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:eS******** ******@TK2MSFTN GP11.phx.gbl...
Geez..so much for reading through everything....i didn't catch that at
all.

One solution is to do everything on the client-side...which has its up and down side.

Another one is to turn on SmartNavigation which only works in IE and some people have a lot of problems with it. Try putting SmartNaviation= true
in
the <%@ Page directive...
You should check out:
http://weblogs.asp.net/ksamaschke/ar...4/27/6085.aspx or just do a
google search for SmartNavigation

Other that that, it's the nature of doing web programming...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.e du> wrote in message
news:Ox******** ******@TK2MSFTN GP09.phx.gbl...
If I do that, it works fine like I said but, flickers?

I don't want it to flicker when I do this.

thanks
gv
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:e5******** ******@TK2MSFTN GP09.phx.gbl...
> Gv:
> It works fine for me. Are you sure you have the AutoPostBack=tr ue for
the
> dropdownlist?
>
> karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "gv" <vi*****@musc.e du> wrote in message
> news:%2******** **********@TK2M SFTNGP12.phx.gb l...
>> Ok,
>>
>> Hi all, new to asp.net. Simple question
>>
>> with web forms
>>
>> I have a Dropdownlist and a listbox, I want to click on and item in
>> the
>> dropdownlist and show items in listbox. that simple
>>
>> I have this: I have two items in Dropdownlist. The Reportlist

doesn't >> show
>> the items ?
>>
>> I tried to set the Autopostback to true. This does work but, the page >> flickers
>>
>> Private Sub Databaselist_Se lectedIndexChan ged(ByVal sender As
>> System.Object, ByVal e As System.EventArg s) Handles
>> Databaselist.Se lectedIndexChan ged
>> If Databaselist.Se lectedValue = "Test1" Then
>>
>> ReportList.Item s.Clear()
>> ReportList.Item s.Add("Test1Tot als by Date Range")
>> ReportList.Item s.Add("Test1Tot als by name and Date Range") >>
>> ElseIf Databaselist.Se lectedValue = "Test2" Then
>>
>> ReportList.Item s.Clear()
>> ReportList.Item s.Add("Test2Tot als by Date Range")
>> ReportList.Item s.Add("Test2 Totals by name and Date
>> Range")
>>
>> End If
>> End Sub
>>
>>
>
>



Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1749
by: ShadowsOfTheBeast | last post by:
hi oliver thanks for your help i kinda figured that out minutes afterwards...but what i am actually trying to do is this: i have a listbox control that gets its data from another listbox (hence gets a subset by selecting from the first list box) and i have a datagrid which has a template column and a bound column, i want to bind the bound column to this second listbox and then its template column implements a dropdownlist for every bound...
1
441
by: Renato | last post by:
Does anyone know how to show a listbox with different colors on its itens? Here goes what I've been trying to do: On Page_OnLoad event I fill the dropdownlist and then I perform a FOR to read this dropdownlist to change the color of some items in it but this doesn't seem to work. The line below is what I tried to use to perform this action but it didn't work out
2
1623
by: Big E | last post by:
I'm using ASP.Net and 1 Listbox and 1 ComboBox. When a user selects the contents in the listbox I want to populate the combobox with the text that he selected or double clicked. I've tried various things with the selecteditem, index properties to no avail. Meaning: LISTBOX has CAR, DOG, BAT, HAT already populated in it. When user selects DOG -> I would like to populate the ComboBox with DOG. I'm writing everything in the vb file in...
3
3490
by: RockNRoll | last post by:
Greetings, Can I select an item in a listbox based on user textbox entry and a submit button? Can you provide any code examples for what needs to occur when the user clicks submit? Thank you, -Dave
5
3538
by: Lie | last post by:
Hi all, I have problem in getting selectedindex of multiple listbox selection in a datagrid. I have a listbox with multiple selection mode inside datagrid. In Edit mode, I need to get back all selected items of that listbox and display it. can anyone help? Thanks
1
4299
by: Patrik Zdarsa | last post by:
Hi, I'm try VS 2005 and need UPDATE database record in viewform, all working when every filed is type TextBox (html INPUT) but I need change one TextBox to Listbox or dropdownlist and read data from another table and store it in table1 in parameter "stav". Load data to ListBox is not problem but when I try update record there is error "stav is null", is any way how to bind listbox or dropdownlist. Code: <UpdateParameters>
4
4758
by: Jeff User | last post by:
Hi Using .NET 1.1, C#, web app I (actually our client) would like to be able to double click a selection in a listbox and have it postback to server . There I would want to access the item that was double clicked. Any idea how to go about this? Thanks
3
6392
by: Mel | last post by:
On a tab I have one DropDownList which requires a postback and two ListBoxes which do not require any postback because I just have some javascript, defined in the aspx file, to copy items from one listbox to the other. All 3 of these controls exist in a table which is inside an UpdatePanel. When the drop down list value changes and the postback occurs the data that I had in my listbox control disappears. How do I fix this? (using:...
0
1832
by: Mel | last post by:
On Oct 23, 8:30 am, bruce barker <nos...@nospam.comwrote: Huh? Did you mean Listbox not DropDownList? The drop-down is working fine, it's the Listbox data that gets cleared after the drop-down list causes the postback.
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10356
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10361
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7644
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.