473,542 Members | 9,296 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_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Databaselist.SelectedIndexChanged
If Databaselist.SelectedValue = "Test1" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test1Totals by Date Range")
ReportList.Items.Add("Test1Totals by name and Date Range")

ElseIf Databaselist.SelectedValue = "Test2" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test2Totals by Date Range")
ReportList.Items.Add("Test2 Totals by name and Date Range")

End If
End Sub
Nov 19 '05 #1
8 1468
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.edu> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
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_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Databaselist.SelectedIndexChanged
If Databaselist.SelectedValue = "Test1" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test1Totals by Date Range")
ReportList.Items.Add("Test1Totals by name and Date Range")

ElseIf Databaselist.SelectedValue = "Test2" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test2Totals by Date Range")
ReportList.Items.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=true for the
dropdownlist?

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.edu> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
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_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Databaselist.SelectedIndexChanged
If Databaselist.SelectedValue = "Test1" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test1Totals by Date Range")
ReportList.Items.Add("Test1Totals by name and Date Range")

ElseIf Databaselist.SelectedValue = "Test2" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test2Totals by Date Range")
ReportList.Items.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 SelectedIndexChanged event fires.

GV


"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:uv**************@TK2MSFTNGP11.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.edu> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
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_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Databaselist.SelectedIndexChanged
If Databaselist.SelectedValue = "Test1" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test1Totals by Date Range")
ReportList.Items.Add("Test1Totals by name and Date Range")

ElseIf Databaselist.SelectedValue = "Test2" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test2Totals by Date Range")
ReportList.Items.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**************@TK2MSFTNGP09.phx.gbl...
Gv:
It works fine for me. Are you sure you have the AutoPostBack=true for the
dropdownlist?

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.edu> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
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_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Databaselist.SelectedIndexChanged
If Databaselist.SelectedValue = "Test1" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test1Totals by Date Range")
ReportList.Items.Add("Test1Totals by name and Date Range")

ElseIf Databaselist.SelectedValue = "Test2" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test2Totals by Date Range")
ReportList.Items.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.edu> wrote in message
news:Ox**************@TK2MSFTNGP09.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**************@TK2MSFTNGP09.phx.gbl...
Gv:
It works fine for me. Are you sure you have the AutoPostBack=true for the dropdownlist?

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.edu> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
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_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Databaselist.SelectedIndexChanged
If Databaselist.SelectedValue = "Test1" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test1Totals by Date Range")
ReportList.Items.Add("Test1Totals by name and Date Range")

ElseIf Databaselist.SelectedValue = "Test2" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test2Totals by Date Range")
ReportList.Items.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.edu> wrote in message
news:Ox**************@TK2MSFTNGP09.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**************@TK2MSFTNGP09.phx.gbl...
Gv:
It works fine for me. Are you sure you have the AutoPostBack=true for
the
dropdownlist?

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"gv" <vi*****@musc.edu> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
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_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Databaselist.SelectedIndexChanged
If Databaselist.SelectedValue = "Test1" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test1Totals by Date Range")
ReportList.Items.Add("Test1Totals by name and Date Range")

ElseIf Databaselist.SelectedValue = "Test2" Then

ReportList.Items.Clear()
ReportList.Items.Add("Test2Totals by Date Range")
ReportList.Items.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**************@TK2MSFTNGP11.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.edu> wrote in message
news:Ox**************@TK2MSFTNGP09.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**************@TK2MSFTNGP09.phx.gbl...
> Gv:
> It works fine for me. Are you sure you have the AutoPostBack=true for the > dropdownlist?
>
> karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "gv" <vi*****@musc.edu> wrote in message
> news:%2******************@TK2MSFTNGP12.phx.gbl...
>> 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_SelectedIndexChanged(ByVal sender As
>> System.Object, ByVal e As System.EventArgs) Handles
>> Databaselist.SelectedIndexChanged
>> If Databaselist.SelectedValue = "Test1" Then
>>
>> ReportList.Items.Clear()
>> ReportList.Items.Add("Test1Totals by Date Range")
>> ReportList.Items.Add("Test1Totals by name and Date Range")
>>
>> ElseIf Databaselist.SelectedValue = "Test2" Then
>>
>> ReportList.Items.Clear()
>> ReportList.Items.Add("Test2Totals by Date Range")
>> ReportList.Items.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.edu> wrote in message
news:O$**************@TK2MSFTNGP09.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**************@TK2MSFTNGP11.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.edu> wrote in message
news:Ox**************@TK2MSFTNGP09.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**************@TK2MSFTNGP09.phx.gbl...
> Gv:
> It works fine for me. Are you sure you have the AutoPostBack=true for
the
> dropdownlist?
>
> karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "gv" <vi*****@musc.edu> wrote in message
> news:%2******************@TK2MSFTNGP12.phx.gbl...
>> 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_SelectedIndexChanged(ByVal sender As
>> System.Object, ByVal e As System.EventArgs) Handles
>> Databaselist.SelectedIndexChanged
>> If Databaselist.SelectedValue = "Test1" Then
>>
>> ReportList.Items.Clear()
>> ReportList.Items.Add("Test1Totals by Date Range")
>> ReportList.Items.Add("Test1Totals by name and Date Range") >>
>> ElseIf Databaselist.SelectedValue = "Test2" Then
>>
>> ReportList.Items.Clear()
>> ReportList.Items.Add("Test2Totals by Date Range")
>> ReportList.Items.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
1730
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...
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...
2
1610
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...
3
3456
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
3516
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
4280
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...
4
4739
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
6382
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...
0
1816
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
7384
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...
0
7567
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. ...
1
7316
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...
0
7665
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...
1
5239
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...
0
4878
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3377
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.