473,385 Members | 1,712 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,385 software developers and data experts.

Set display order of ListBox control

Hi
I have a ListBox control in my ASP.NET page. After I binding data to this
control, I would like to be able to change this display order of items in
this control. Just like change layout function of my.yahoo.com.
I tried client side approach, yes I can change display order by JavaScript,
but after clicking one of the button the display order will reverse back to
its original status. Because after PostBack, the page will try to render
this control by viewstate again.

I tried server side approach, but looks there is no way to switch two
ListItems programmatically.
Is there anybody who has some good idea?

Thanks!

--

WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
Nov 16 '05 #1
4 3285
I already solved this problem.
"Hardy Wang" <ha********@marketrend.com> wrote in message
news:up*************@TK2MSFTNGP11.phx.gbl...
Hi
I have a ListBox control in my ASP.NET page. After I binding data to this
control, I would like to be able to change this display order of items in
this control. Just like change layout function of my.yahoo.com.
I tried client side approach, yes I can change display order by JavaScript, but after clicking one of the button the display order will reverse back to its original status. Because after PostBack, the page will try to render
this control by viewstate again.

I tried server side approach, but looks there is no way to switch two
ListItems programmatically.
Is there anybody who has some good idea?

Thanks!

--

WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy

Nov 16 '05 #2
How?
--
Joe Fallon

"Hardy Wang" <ha********@marketrend.com> wrote in message
news:O7**************@tk2msftngp13.phx.gbl...
I already solved this problem.
"Hardy Wang" <ha********@marketrend.com> wrote in message
news:up*************@TK2MSFTNGP11.phx.gbl...
Hi
I have a ListBox control in my ASP.NET page. After I binding data to this control, I would like to be able to change this display order of items in this control. Just like change layout function of my.yahoo.com.
I tried client side approach, yes I can change display order by

JavaScript,
but after clicking one of the button the display order will reverse back

to
its original status. Because after PostBack, the page will try to render
this control by viewstate again.

I tried server side approach, but looks there is no way to switch two
ListItems programmatically.
Is there anybody who has some good idea?

Thanks!

--

WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy


Nov 16 '05 #3
Dump content of listbox to array, sort array in memory, then clear this
listbox and add listitem from array one by one.

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
How?
--
Joe Fallon

"Hardy Wang" <ha********@marketrend.com> wrote in message
news:O7**************@tk2msftngp13.phx.gbl...
I already solved this problem.
"Hardy Wang" <ha********@marketrend.com> wrote in message
news:up*************@TK2MSFTNGP11.phx.gbl...
Hi
I have a ListBox control in my ASP.NET page. After I binding data to this control, I would like to be able to change this display order of items in this control. Just like change layout function of my.yahoo.com.
I tried client side approach, yes I can change display order by

JavaScript,
but after clicking one of the button the display order will reverse back
to
its original status. Because after PostBack, the page will try to

render this control by viewstate again.

I tried server side approach, but looks there is no way to switch two
ListItems programmatically.
Is there anybody who has some good idea?

Thanks!

--

WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy



Nov 16 '05 #4
Yep.
That is what my listbox sort routine does.
Just wondering if you came up with something different.
--
Joe Fallon

"Hardy Wang" <ha********@marketrend.com> wrote in message
news:uV**************@TK2MSFTNGP12.phx.gbl...
Dump content of listbox to array, sort array in memory, then clear this
listbox and add listitem from array one by one.

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
How?
--
Joe Fallon

"Hardy Wang" <ha********@marketrend.com> wrote in message
news:O7**************@tk2msftngp13.phx.gbl...
I already solved this problem.
"Hardy Wang" <ha********@marketrend.com> wrote in message
news:up*************@TK2MSFTNGP11.phx.gbl...
> Hi
> I have a ListBox control in my ASP.NET page. After I binding data to

this
> control, I would like to be able to change this display order of items
in
> this control. Just like change layout function of my.yahoo.com.
> I tried client side approach, yes I can change display order by
JavaScript,
> but after clicking one of the button the display order will reverse back to
> its original status. Because after PostBack, the page will try to render > this control by viewstate again.
>
> I tried server side approach, but looks there is no way to switch

two > ListItems programmatically.
>
>
> Is there anybody who has some good idea?
>
> Thanks!
>
> --
>
>
>
> WWW: http://hardywang.1accesshost.com
> ICQ: 3359839
> yours Hardy
>
>



Nov 16 '05 #5

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

Similar topics

0
by: serge calderara | last post by:
Dear all, I need to display in my application incoming data from an external source which is pooled every 2 seconds. Thos data actually are displaye in a listbox control, but the problem I...
1
by: Seth Delaney | last post by:
I have a form with a combobox and a list box. The combobox will list records (names of queries) that are entered in a table called tblListName. I have the combobox set to get its values from this...
2
by: joan.edington | last post by:
Hi, I've not done a lot of MS Access work and have been tasked with creating a database to record and report on stages of complaints cases. Each set of records for a case has a header, any...
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
4
by: Hardy Wang | last post by:
Hi I have a ListBox control in my ASP.NET page. After I binding data to this control, I would like to be able to change this display order of items in this control. Just like change layout...
2
by: j.m.osterman | last post by:
I haven't found exactly what I've been trying to do. All I am trying to do for now is just display usernames from Active Directory into a ListBox control on a page. I have found some code...
2
by: ApexData | last post by:
I am working on a lookup form, where the user will enter LastName FirstName and check for duplicates. I have a list box that is bound to a table of 200 members. After the user enters the name, I...
1
by: ApexData | last post by:
I would like to control a Listbox's content display. I am working on a lookup form, where the user will enter a LastName and FirstName in unbound textboxes and then check for duplicates in a table...
2
by: kimiraikkonen | last post by:
Hi experts, I need to display some custom text ouptut in a Listbox and the first 4 lines of listbox (index items) will be removed. the problem is not to know how to display custom text "line by...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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,...

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.