Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ASP.NET Gridview, bring highlighted rows to top

ASP.NET Gridview, bring highlighted rows to top

Scheduled Pinned Locked Moved ASP.NET
csharpcssasp-netdatabasehelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Inderjeet Kaur
    wrote on last edited by
    #1

    I have a grid view which can have any number of records. I have a text box to search for card numbers. I highlight the rows with matching card numbers in RowDataBound event. Now i want to bring the Highlighted rows to top. I do not want to remove all other records. I want to show all records and want to bring highlighted records to top. I urgently need the solution for this query. Any help will be appreciated. Thanks in Advance! Inderjeet Kaur I tried using Select * from abc where condition = searchcondition UNION ALL Select * from abc where condition <> searchcondition But, it works only if i have to search one fileld. Now i have to run search on two fileds it will return lots on rows

    Inderjeet Kaur Sr. Software Engg

    V S 2 Replies Last reply
    0
    • I Inderjeet Kaur

      I have a grid view which can have any number of records. I have a text box to search for card numbers. I highlight the rows with matching card numbers in RowDataBound event. Now i want to bring the Highlighted rows to top. I do not want to remove all other records. I want to show all records and want to bring highlighted records to top. I urgently need the solution for this query. Any help will be appreciated. Thanks in Advance! Inderjeet Kaur I tried using Select * from abc where condition = searchcondition UNION ALL Select * from abc where condition <> searchcondition But, it works only if i have to search one fileld. Now i have to run search on two fileds it will return lots on rows

      Inderjeet Kaur Sr. Software Engg

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      What you can do , is to order by the Card numbers. do it on your SQL Side and the rows that have the card number you searched for will be on the top part

      Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

      I 1 Reply Last reply
      0
      • V Vimalsoft Pty Ltd

        What you can do , is to order by the Card numbers. do it on your SQL Side and the rows that have the card number you searched for will be on the top part

        Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

        I Offline
        I Offline
        Inderjeet Kaur
        wrote on last edited by
        #3

        Hi Order By wll bring the rows in asc or desc order. What if i want in between records on top SELECT * FROM ( SELECT TranID AS TranID, CardAcceptorIdCode as MerchantNumber, PrimaryAccountNumber AS CardNumber, TranTime as TxnDate, TransactionAmount as TxnAmount, CASE CCL1.LutDescription WHEN 'REDEMPTION' THEN 'PURCHASE' ELSE CCL1.LutDescription END as TxnType, CASE CCL1.LutDescription WHEN 'REDEMPTION' THEN 'CR' WHEN CCL1.LutDescription THEN 'DR' END as DbCrdDetails, LocalTxnDate, LocalTxnTime, PrimaryCurrencyCode AS Currency, TxnCode_internal AS MTC, ISNULL(ExcludeRecon, 0) AS ExcludeRecon --CASE ExcludeRecon WHEN NULL THEN 0 ELSE ExcludeRecon END AS ExcludeRecon FROM CCardTransactions inner join CCardLookup CCL1 on TranType = CCL1.LUTCode and TranType in (10,40,37,42,30) and CCL1.LUTID = 'LM' WHERE TRANTIME BETWEEN 'Jul 29 2009 12:00AM' AND 'Jul 29 2009 11:59PM' AND CardAcceptorIdCode = 48484 ) AS CCARDTRAN1 WHERE CardNumber = '2423423453534556' --ORDER BY CardNUmber UNION ALL SELECT * FROM ( SELECT TranID AS TranID, CardAcceptorIdCode as MerchantNumber, PrimaryAccountNumber AS CardNumber, TranTime as TxnDate, TransactionAmount as TxnAmount, CASE CCL1.LutDescription WHEN 'REDEMPTION' THEN 'PURCHASE' ELSE CCL1.LutDescription END as TxnType, CASE CCL1.LutDescription WHEN 'REDEMPTION' THEN 'CR' WHEN CCL1.LutDescription THEN 'DR' END as DbCrdDetails, LocalTxnDate, LocalTxnTime, PrimaryCurrencyCode AS Currency, TxnCode_internal AS MTC, ISNULL(ExcludeRecon, 0) AS ExcludeRecon --CASE ExcludeRecon WHEN NULL THEN 0 ELSE ExcludeRecon END AS ExcludeRecon FROM CCardTransactions inner join CCardLookup CCL1 on TranType = CCL1.LUTCode and TranType in (10,40,37,42,30) and CCL1.LUTID = 'LM' WHERE TRANTIME BETWEEN 'Jul 29 2009 12:00AM' AND 'Jul 29 2009 11:59PM' AND CardAcceptorIdCode = 48484 ) AS CCARDTRAN2 WHERE CardNumber <> '2423423453534556' This is my query and i want top bring records searched by CardNUmber or TxnType on top

        Inderjeet Kaur Sr. Software Engg

        V 1 Reply Last reply
        0
        • I Inderjeet Kaur

          Hi Order By wll bring the rows in asc or desc order. What if i want in between records on top SELECT * FROM ( SELECT TranID AS TranID, CardAcceptorIdCode as MerchantNumber, PrimaryAccountNumber AS CardNumber, TranTime as TxnDate, TransactionAmount as TxnAmount, CASE CCL1.LutDescription WHEN 'REDEMPTION' THEN 'PURCHASE' ELSE CCL1.LutDescription END as TxnType, CASE CCL1.LutDescription WHEN 'REDEMPTION' THEN 'CR' WHEN CCL1.LutDescription THEN 'DR' END as DbCrdDetails, LocalTxnDate, LocalTxnTime, PrimaryCurrencyCode AS Currency, TxnCode_internal AS MTC, ISNULL(ExcludeRecon, 0) AS ExcludeRecon --CASE ExcludeRecon WHEN NULL THEN 0 ELSE ExcludeRecon END AS ExcludeRecon FROM CCardTransactions inner join CCardLookup CCL1 on TranType = CCL1.LUTCode and TranType in (10,40,37,42,30) and CCL1.LUTID = 'LM' WHERE TRANTIME BETWEEN 'Jul 29 2009 12:00AM' AND 'Jul 29 2009 11:59PM' AND CardAcceptorIdCode = 48484 ) AS CCARDTRAN1 WHERE CardNumber = '2423423453534556' --ORDER BY CardNUmber UNION ALL SELECT * FROM ( SELECT TranID AS TranID, CardAcceptorIdCode as MerchantNumber, PrimaryAccountNumber AS CardNumber, TranTime as TxnDate, TransactionAmount as TxnAmount, CASE CCL1.LutDescription WHEN 'REDEMPTION' THEN 'PURCHASE' ELSE CCL1.LutDescription END as TxnType, CASE CCL1.LutDescription WHEN 'REDEMPTION' THEN 'CR' WHEN CCL1.LutDescription THEN 'DR' END as DbCrdDetails, LocalTxnDate, LocalTxnTime, PrimaryCurrencyCode AS Currency, TxnCode_internal AS MTC, ISNULL(ExcludeRecon, 0) AS ExcludeRecon --CASE ExcludeRecon WHEN NULL THEN 0 ELSE ExcludeRecon END AS ExcludeRecon FROM CCardTransactions inner join CCardLookup CCL1 on TranType = CCL1.LUTCode and TranType in (10,40,37,42,30) and CCL1.LUTID = 'LM' WHERE TRANTIME BETWEEN 'Jul 29 2009 12:00AM' AND 'Jul 29 2009 11:59PM' AND CardAcceptorIdCode = 48484 ) AS CCARDTRAN2 WHERE CardNumber <> '2423423453534556' This is my query and i want top bring records searched by CardNUmber or TxnType on top

          Inderjeet Kaur Sr. Software Engg

          V Offline
          V Offline
          Vimalsoft Pty Ltd
          wrote on last edited by
          #4

          You can choose if you want them asc or desc by adding something like

          Order by CardNumber asc

          or

          Order by CardNumber desc

          Hope this Helps

          Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

          1 Reply Last reply
          0
          • I Inderjeet Kaur

            I have a grid view which can have any number of records. I have a text box to search for card numbers. I highlight the rows with matching card numbers in RowDataBound event. Now i want to bring the Highlighted rows to top. I do not want to remove all other records. I want to show all records and want to bring highlighted records to top. I urgently need the solution for this query. Any help will be appreciated. Thanks in Advance! Inderjeet Kaur I tried using Select * from abc where condition = searchcondition UNION ALL Select * from abc where condition <> searchcondition But, it works only if i have to search one fileld. Now i have to run search on two fileds it will return lots on rows

            Inderjeet Kaur Sr. Software Engg

            S Offline
            S Offline
            Sundeep Ganiga
            wrote on last edited by
            #5

            Self Manipulation of Records of dataset is required here. after binding the database initially and on card number entry,You try to highlight those matching rows and finally after completing highlight part,remove those all rows from dataset and insert at Top position and then rebind the Grid.This should be done at the end in order not to break performance issue. Hope so I am correct. All The Best:thumbsup:

            Sundeep Ganiga When the only tool you have is a hammer, everything looks like a nail. Come Forth Yourself to Click "Good Answer" for any expected solution. Let us Support our C Project Programmers who provide solutions here.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups