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. how to use Filter on Dataview string like te*xt%

how to use Filter on Dataview string like te*xt%

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-nettutorial
8 Posts 2 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.
  • B Offline
    B Offline
    BalasahebK
    wrote on last edited by
    #1

    Hello Everybody, Can someone help in finding solution for dataview filter I know how to use dataview filter and I had been using dataview for my application for biding 5 gridview. Every gridview is binded by dataview. And when I'm using filter by sending filter criteria using textbox, it is possible to send any kind of string to filter the dataview. Now problem is when I send string like 1) *text, it works fine 2) text*, it works fine 3) te*xt, it fails why this is so? Can someone please help me in this regard :) Solution on this will be appreciated :rolleyes: Regards Balasaheb Kahat

    Balasaheb Software Developer Platform: Asp.net,vb.net

    S 1 Reply Last reply
    0
    • B BalasahebK

      Hello Everybody, Can someone help in finding solution for dataview filter I know how to use dataview filter and I had been using dataview for my application for biding 5 gridview. Every gridview is binded by dataview. And when I'm using filter by sending filter criteria using textbox, it is possible to send any kind of string to filter the dataview. Now problem is when I send string like 1) *text, it works fine 2) text*, it works fine 3) te*xt, it fails why this is so? Can someone please help me in this regard :) Solution on this will be appreciated :rolleyes: Regards Balasaheb Kahat

      Balasaheb Software Developer Platform: Asp.net,vb.net

      S Offline
      S Offline
      Sylvester george
      wrote on last edited by
      #2

      WILDCARD CHARACTERS Both the * and % can be used interchangeably for wildcard characters in a LIKE comparison. If the string in a LIKE clause contains a * or %, those characters should be escaped in brackets ([]). If a bracket is in the clause, the bracket characters should be escaped in brackets (for example [[] or []]). A wildcard is allowed at the start and end of a pattern, or at the end of a pattern, or at the start of a pattern. For example: "ItemName LIKE '*product*'" "ItemName LIKE '*product'" "ItemName LIKE 'product*'" Wildcard characters are not allowed in the middle of a string. For example, 'te*xt' is not allowed. for more info ============= http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx[^]

      Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com

      B 1 Reply Last reply
      0
      • S Sylvester george

        WILDCARD CHARACTERS Both the * and % can be used interchangeably for wildcard characters in a LIKE comparison. If the string in a LIKE clause contains a * or %, those characters should be escaped in brackets ([]). If a bracket is in the clause, the bracket characters should be escaped in brackets (for example [[] or []]). A wildcard is allowed at the start and end of a pattern, or at the end of a pattern, or at the start of a pattern. For example: "ItemName LIKE '*product*'" "ItemName LIKE '*product'" "ItemName LIKE 'product*'" Wildcard characters are not allowed in the middle of a string. For example, 'te*xt' is not allowed. for more info ============= http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx[^]

        Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com

        B Offline
        B Offline
        BalasahebK
        wrote on last edited by
        #3

        ok then how to solve above problem using dataview because user can send string like te*xt, is there any way? Please suggest some way to solve such problem Regards,

        Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000

        S 1 Reply Last reply
        0
        • B BalasahebK

          ok then how to solve above problem using dataview because user can send string like te*xt, is there any way? Please suggest some way to solve such problem Regards,

          Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000

          S Offline
          S Offline
          Sylvester george
          wrote on last edited by
          #4

          put delimeter [ and ] programmatically RowFilter = "Name Like 'Sar[*]avanan'" this will give Names like 'Sar*avanan'

          Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com

          B 1 Reply Last reply
          0
          • S Sylvester george

            put delimeter [ and ] programmatically RowFilter = "Name Like 'Sar[*]avanan'" this will give Names like 'Sar*avanan'

            Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com

            B Offline
            B Offline
            BalasahebK
            wrote on last edited by
            #5

            Thanks for quick & useful reply I have tried ur code doesn't give expected answer. Explaination:- RowFilter = "Name Like 'Sar[*]avanan'" Suppose Name contains like "Sareeavan", the above doesn't return "Sareeavan" as result, but returns blank I have a column named "ref" which contains records like 0007k, 0017,0127, I like find out records such as starting with 0*7 search criteria (This should min return 0007k, but wont). As per logic 0*7 should return all above values as result. RowFilter doesn't work on such criteria, do u have any solution on such criteria? Regads,

            Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000

            S 1 Reply Last reply
            0
            • B BalasahebK

              Thanks for quick & useful reply I have tried ur code doesn't give expected answer. Explaination:- RowFilter = "Name Like 'Sar[*]avanan'" Suppose Name contains like "Sareeavan", the above doesn't return "Sareeavan" as result, but returns blank I have a column named "ref" which contains records like 0007k, 0017,0127, I like find out records such as starting with 0*7 search criteria (This should min return 0007k, but wont). As per logic 0*7 should return all above values as result. RowFilter doesn't work on such criteria, do u have any solution on such criteria? Regads,

              Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000

              S Offline
              S Offline
              Sylvester george
              wrote on last edited by
              #6

              you misunderstood that. We can not do any pattern like 'te*xt' . If you want escape the character * from users input. we need to use delimeter [ and ] to remove compilation errors.

              Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com

              B 1 Reply Last reply
              0
              • S Sylvester george

                you misunderstood that. We can not do any pattern like 'te*xt' . If you want escape the character * from users input. we need to use delimeter [ and ] to remove compilation errors.

                Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com

                B Offline
                B Offline
                BalasahebK
                wrote on last edited by
                #7

                Thanks for ur reply Finally conclusion is Dataview can not filter string starting with 00*7, we have to do some other solution, is it correct? otherwise I have to query to database for filter criteria of such requirement. What I was doing earlier Retreiving data from database and keep it in cache[20 mins] For every postback on same page, dataset is fill with this cache data. Then this ds is converted into dataview in order to filter the record. Postback happen when 1) on button click Filter, 2) ShowAll button Click 3) Paging 4) Sorting Regards

                Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000

                S 1 Reply Last reply
                0
                • B BalasahebK

                  Thanks for ur reply Finally conclusion is Dataview can not filter string starting with 00*7, we have to do some other solution, is it correct? otherwise I have to query to database for filter criteria of such requirement. What I was doing earlier Retreiving data from database and keep it in cache[20 mins] For every postback on same page, dataset is fill with this cache data. Then this ds is converted into dataview in order to filter the record. Postback happen when 1) on button click Filter, 2) ShowAll button Click 3) Paging 4) Sorting Regards

                  Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000

                  S Offline
                  S Offline
                  Sylvester george
                  wrote on last edited by
                  #8

                  Yes. You should handle this kind of pattern in Database query or Do it manually. You can not get advantage from RowFilter for this sort of patterns

                  Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com

                  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