Manually sort elements in datagrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Garry Newman

    #1

    Manually sort elements in datagrid

    How can I manually sort elements in my datagrid as .NET
    places them in alphabetical order ?

    G.N
  • Garry Newman

    #2
    Manually sort elements in datagrid

    As in how can I manually arrange the order of the fields
    in my datagrid so that they appear the way I want, not
    alphabetical ?

    G.N

    Comment

    • Jan Tielens

      #3
      Re: Manually sort elements in datagrid

      Are you using WebForms or WindowsForms?

      In WindowsForms you can accomplish this by adding a TableStyle to your grid
      and putting column definitions in this TableStyle. You can do this quit easy
      in the designer.

      --
      Greetz

      Jan Tielens
      _______________ _______________ __
      Read my weblog: http://weblogs.asp.net/jan


      "Garry Newman" <anonymous@disc ussions.microso ft.com> wrote in message
      news:08a601c3bf 11$2e662060$a40 1280a@phx.gbl.. .[color=blue]
      > As in how can I manually arrange the order of the fields
      > in my datagrid so that they appear the way I want, not
      > alphabetical ?
      >
      > G.N[/color]


      Comment

      • Ken Tucker [MVP]

        #4
        Re: Manually sort elements in datagrid

        Hi,

        You have to add a tablestyle to the datagrid.
        http://msdn.microsoft.com/library/de...asicprimer.asp

        Ken
        -------------------------------
        "Garry Newman" <anonymous@disc ussions.microso ft.com> wrote in message
        news:08a601c3bf 11$2e662060$a40 1280a@phx.gbl.. .[color=blue]
        > As in how can I manually arrange the order of the fields
        > in my datagrid so that they appear the way I want, not
        > alphabetical ?
        >
        > G.N[/color]


        Comment

        • Garry Newman

          #5
          Re: Manually sort elements in datagrid

          ok I've added a tablestyle to the DataGrid and then added
          my fields (in the order I want) as memebers of the
          DataGridColumnS tyleCollection by setting the Mapping Name
          property to the relevant field in my table, but this
          doesn't make any difference to the order at runtime, so
          I've either missed a step or set the wrong property ???

          any ideas

          Thanks G.N

          Comment

          • Jan Tielens

            #6
            Re: Manually sort elements in datagrid

            Did you set the MappingName of the TableStyle equal to the name of your
            DataTable?

            --
            Greetz

            Jan Tielens
            _______________ _______________ __
            Read my weblog: http://weblogs.asp.net/jan


            "Garry Newman" <anonymous@disc ussions.microso ft.com> wrote in message
            news:0a9c01c3bf 16$88779570$a30 1280a@phx.gbl.. .[color=blue]
            > ok I've added a tablestyle to the DataGrid and then added
            > my fields (in the order I want) as memebers of the
            > DataGridColumnS tyleCollection by setting the Mapping Name
            > property to the relevant field in my table, but this
            > doesn't make any difference to the order at runtime, so
            > I've either missed a step or set the wrong property ???
            >
            > any ideas
            >
            > Thanks G.N[/color]


            Comment

            • Garry Newman

              #7
              Re: Manually sort elements in datagrid

              Yeah I did that but...

              I made two extremely stupid mistakes the first was not to
              give the column headers names and the second was not to
              fill the dataset these events resulted in instant
              confusion and bewilderment

              Thanks for your help

              G.N

              Comment

              Working...