binding source position when sorted

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

    binding source position when sorted

    VS 2005

    I want to make sure I have this concept down correctly.

    I have a strongly typed datatable and a binding source connected to it.

    On my windows form a grid is connected to the binding source.

    When the grid is unsorted the datatable(bindi ngsource.posito n).mycol =
    DirectCast(bind ingsource.curre nt, datarowview).It em("mycol").

    When I sort the grid the bindingsource.p osition is now out of synch with the
    underlying datatable so the above are not equal.

    I ask becuase I have to use a column value in a bindingsource positon
    changed event and if the grid is sorted the value is no longer in synch.

    Do I have this correct?

    Rick


  • ClayB

    #2
    Re: binding source position when sorted

    Instead of datatable(bindi ngsource.posito n), try using
    datatable.Defau ltView(bindings ource.positon). I think this should
    match up with bindingsource.c urrent even if the grid is sorted.

    =============== ==========
    Clay Burch
    Syncfusion, Inc.

    Comment

    • Rick

      #3
      Re: binding source position when sorted

      Thanks, but that doesn't work.

      With some sorts it is the same, but others no. I thought it was numeric vs
      string sorts, but that didn't hold out.

      I ended up by casting bindingsource.c urrent as a datarowview and then get
      the column value.

      Rick

      "ClayB" <clayb@syncfusi on.comwrote in message
      news:1177198954 .253503.309550@ y80g2000hsf.goo glegroups.com.. .
      Instead of datatable(bindi ngsource.posito n), try using
      datatable.Defau ltView(bindings ource.positon). I think this should
      match up with bindingsource.c urrent even if the grid is sorted.
      >
      =============== ==========
      Clay Burch
      Syncfusion, Inc.
      >

      Comment

      • Earl

        #4
        Re: binding source position when sorted

        Sort the BindingSource.

        "Rick" <Rick@LakeValle ySeed.comwrote in message
        news:uy4YnLBhHH A.2332@TK2MSFTN GP04.phx.gbl...
        VS 2005
        >
        I want to make sure I have this concept down correctly.
        >
        I have a strongly typed datatable and a binding source connected to it.
        >
        On my windows form a grid is connected to the binding source.
        >
        When the grid is unsorted the datatable(bindi ngsource.posito n).mycol =
        DirectCast(bind ingsource.curre nt, datarowview).It em("mycol").
        >
        When I sort the grid the bindingsource.p osition is now out of synch with
        the underlying datatable so the above are not equal.
        >
        I ask becuase I have to use a column value in a bindingsource positon
        changed event and if the grid is sorted the value is no longer in synch.
        >
        Do I have this correct?
        >
        Rick
        >

        Comment

        • Cor Ligthert [MVP]

          #5
          Re: binding source position when sorted

          Still is the sort code placed in the
          datasource.defa ultview.sort propertie

          Cor

          "Rick" <Rick@LakeValle ySeed.comschree f in bericht
          news:ulmm$RHhHH A.1216@TK2MSFTN GP03.phx.gbl...
          Thanks, but that doesn't work.
          >
          With some sorts it is the same, but others no. I thought it was numeric
          vs string sorts, but that didn't hold out.
          >
          I ended up by casting bindingsource.c urrent as a datarowview and then get
          the column value.
          >
          Rick
          >
          "ClayB" <clayb@syncfusi on.comwrote in message
          news:1177198954 .253503.309550@ y80g2000hsf.goo glegroups.com.. .
          >Instead of datatable(bindi ngsource.posito n), try using
          >datatable.Defa ultView(binding source.positon) . I think this should
          >match up with bindingsource.c urrent even if the grid is sorted.
          >>
          >============== ===========
          >Clay Burch
          >Syncfusion, Inc.
          >>
          >
          >

          Comment

          • Rick

            #6
            Re: binding source position when sorted

            Cor,

            I can't tell if you are asking a question or making a statement?

            Rick

            "Cor Ligthert [MVP]" <notmyfirstname @planet.nlwrote in message
            news:uL$ZXdPhHH A.4924@TK2MSFTN GP06.phx.gbl...
            Still is the sort code placed in the
            datasource.defa ultview.sort propertie
            >
            Cor
            >
            "Rick" <Rick@LakeValle ySeed.comschree f in bericht
            news:ulmm$RHhHH A.1216@TK2MSFTN GP03.phx.gbl...
            >Thanks, but that doesn't work.
            >>
            >With some sorts it is the same, but others no. I thought it was numeric
            >vs string sorts, but that didn't hold out.
            >>
            >I ended up by casting bindingsource.c urrent as a datarowview and then get
            >the column value.
            >>
            >Rick
            >>
            >"ClayB" <clayb@syncfusi on.comwrote in message
            >news:117719895 4.253503.309550 @y80g2000hsf.go oglegroups.com. ..
            >>Instead of datatable(bindi ngsource.posito n), try using
            >>datatable.Def aultView(bindin gsource.positon ). I think this should
            >>match up with bindingsource.c urrent even if the grid is sorted.
            >>>
            >>============= ============
            >>Clay Burch
            >>Syncfusion, Inc.
            >>>
            >>
            >>
            >
            >

            Comment

            • Cor Ligthert [MVP]

              #7
              Re: binding source position when sorted

              Statement

              "Rick" <Rick@LakeValle ySeed.comschree f in bericht
              news:OOfD38YhHH A.4980@TK2MSFTN GP02.phx.gbl...
              Cor,
              >
              I can't tell if you are asking a question or making a statement?
              >
              Rick
              >
              "Cor Ligthert [MVP]" <notmyfirstname @planet.nlwrote in message
              news:uL$ZXdPhHH A.4924@TK2MSFTN GP06.phx.gbl...
              >Still is the sort code placed in the
              >datasource.def aultview.sort propertie
              >>
              >Cor
              >>
              >"Rick" <Rick@LakeValle ySeed.comschree f in bericht
              >news:ulmm$RHhH HA.1216@TK2MSFT NGP03.phx.gbl.. .
              >>Thanks, but that doesn't work.
              >>>
              >>With some sorts it is the same, but others no. I thought it was numeric
              >>vs string sorts, but that didn't hold out.
              >>>
              >>I ended up by casting bindingsource.c urrent as a datarowview and then
              >>get the column value.
              >>>
              >>Rick
              >>>
              >>"ClayB" <clayb@syncfusi on.comwrote in message
              >>news:11771989 54.253503.30955 0@y80g2000hsf.g ooglegroups.com ...
              >>>Instead of datatable(bindi ngsource.posito n), try using
              >>>datatable.De faultView(bindi ngsource.posito n). I think this should
              >>>match up with bindingsource.c urrent even if the grid is sorted.
              >>>>
              >>>============ =============
              >>>Clay Burch
              >>>Syncfusion , Inc.
              >>>>
              >>>
              >>>
              >>
              >>
              >
              >

              Comment

              Working...