Set display order of ListBox control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hardy Wang

    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 programmaticall y.


    Is there anybody who has some good idea?

    Thanks!

    --



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


  • Hardy Wang

    #2
    Re: Set display order of ListBox control

    I already solved this problem.


    "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
    news:upQn0K$KEH A.628@TK2MSFTNG P11.phx.gbl...[color=blue]
    > 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[/color]
    JavaScript,[color=blue]
    > but after clicking one of the button the display order will reverse back[/color]
    to[color=blue]
    > 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 programmaticall y.
    >
    >
    > Is there anybody who has some good idea?
    >
    > Thanks!
    >
    > --
    >
    >
    >
    > WWW: http://hardywang.1accesshost.com
    > ICQ: 3359839
    > yours Hardy
    >
    >[/color]


    Comment

    • Joe Fallon

      #3
      Re: Set display order of ListBox control

      How?
      --
      Joe Fallon



      "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
      news:O7ZTxp$KEH A.2244@tk2msftn gp13.phx.gbl...[color=blue]
      > I already solved this problem.
      >
      >
      > "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
      > news:upQn0K$KEH A.628@TK2MSFTNG P11.phx.gbl...[color=green]
      > > Hi
      > > I have a ListBox control in my ASP.NET page. After I binding data to[/color][/color]
      this[color=blue][color=green]
      > > control, I would like to be able to change this display order of items[/color][/color]
      in[color=blue][color=green]
      > > this control. Just like change layout function of my.yahoo.com.
      > > I tried client side approach, yes I can change display order by[/color]
      > JavaScript,[color=green]
      > > but after clicking one of the button the display order will reverse back[/color]
      > to[color=green]
      > > 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 programmaticall y.
      > >
      > >
      > > Is there anybody who has some good idea?
      > >
      > > Thanks!
      > >
      > > --
      > >
      > >
      > >
      > > WWW: http://hardywang.1accesshost.com
      > > ICQ: 3359839
      > > yours Hardy
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Hardy Wang

        #4
        Re: Set display order of ListBox control

        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" <jfallon1@nospa mtwcny.rr.com> wrote in message
        news:%23nd3uPAL EHA.3052@TK2MSF TNGP12.phx.gbl. ..[color=blue]
        > How?
        > --
        > Joe Fallon
        >
        >
        >
        > "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
        > news:O7ZTxp$KEH A.2244@tk2msftn gp13.phx.gbl...[color=green]
        > > I already solved this problem.
        > >
        > >
        > > "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
        > > news:upQn0K$KEH A.628@TK2MSFTNG P11.phx.gbl...[color=darkred]
        > > > Hi
        > > > I have a ListBox control in my ASP.NET page. After I binding data to[/color][/color]
        > this[color=green][color=darkred]
        > > > control, I would like to be able to change this display order of items[/color][/color]
        > in[color=green][color=darkred]
        > > > this control. Just like change layout function of my.yahoo.com.
        > > > I tried client side approach, yes I can change display order by[/color]
        > > JavaScript,[color=darkred]
        > > > but after clicking one of the button the display order will reverse[/color][/color][/color]
        back[color=blue][color=green]
        > > to[color=darkred]
        > > > its original status. Because after PostBack, the page will try to[/color][/color][/color]
        render[color=blue][color=green][color=darkred]
        > > > this control by viewstate again.
        > > >
        > > > I tried server side approach, but looks there is no way to switch two
        > > > ListItems programmaticall y.
        > > >
        > > >
        > > > Is there anybody who has some good idea?
        > > >
        > > > Thanks!
        > > >
        > > > --
        > > >
        > > >
        > > >
        > > > WWW: http://hardywang.1accesshost.com
        > > > ICQ: 3359839
        > > > yours Hardy
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Joe Fallon

          #5
          Re: Set display order of ListBox control

          Yep.
          That is what my listbox sort routine does.
          Just wondering if you came up with something different.
          --
          Joe Fallon



          "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
          news:uVlWuSFLEH A.3808@TK2MSFTN GP12.phx.gbl...[color=blue]
          > 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" <jfallon1@nospa mtwcny.rr.com> wrote in message
          > news:%23nd3uPAL EHA.3052@TK2MSF TNGP12.phx.gbl. ..[color=green]
          > > How?
          > > --
          > > Joe Fallon
          > >
          > >
          > >
          > > "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
          > > news:O7ZTxp$KEH A.2244@tk2msftn gp13.phx.gbl...[color=darkred]
          > > > I already solved this problem.
          > > >
          > > >
          > > > "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
          > > > news:upQn0K$KEH A.628@TK2MSFTNG P11.phx.gbl...
          > > > > Hi
          > > > > I have a ListBox control in my ASP.NET page. After I binding data to[/color]
          > > this[color=darkred]
          > > > > control, I would like to be able to change this display order of[/color][/color][/color]
          items[color=blue][color=green]
          > > in[color=darkred]
          > > > > 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[/color][/color]
          > back[color=green][color=darkred]
          > > > to
          > > > > its original status. Because after PostBack, the page will try to[/color][/color]
          > render[color=green][color=darkred]
          > > > > this control by viewstate again.
          > > > >
          > > > > I tried server side approach, but looks there is no way to switch[/color][/color][/color]
          two[color=blue][color=green][color=darkred]
          > > > > ListItems programmaticall y.
          > > > >
          > > > >
          > > > > Is there anybody who has some good idea?
          > > > >
          > > > > Thanks!
          > > > >
          > > > > --
          > > > >
          > > > >
          > > > >
          > > > > WWW: http://hardywang.1accesshost.com
          > > > > ICQ: 3359839
          > > > > yours Hardy
          > > > >
          > > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          Working...