By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,979 Members | 960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,979 IT Pros & Developers. It's quick & easy.

Set display order of ListBox control

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.