473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1456
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
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...
1
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...
2
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...
3
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,...
5
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...
1
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...
4
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...
3
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...

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.