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 change the filter expresion at runtime ?

how to change the filter expresion at runtime ?

Scheduled Pinned Locked Moved ASP.NET
cssdatabasesysadmintutorialquestion
2 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.
  • M Offline
    M Offline
    md_azy
    wrote on last edited by
    #1

    Hi, <asp:SqlDataSource ID="grid_source" runat="server" ConnectionString="Data Source=db;Initial Catalog=faq;User ID=sa;Password=mercury" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [c_empcode], [c_name], [c_designation], [c_department], [c_emailid], [c_reportingPerson], [c_passwd], [n_status] FROM [Employee_Mst] where n_deleted =0" OnSelecting="grid_source_Selecting" FilterExpression="c_name like '{0}%' and c_department like '{1}%' " > <FilterParameters> <asp:ControlParameter Name="c_name" ControlID="txtname" PropertyName="Text" /> <asp:ControlParameter Name="c_department" ControlID="txtdepart" PropertyName="Text" /> </FilterParameters> </asp:SqlDataSource> This is my sqldatasource in that i used filter expression for filtering data . if txtdepart textbox is empty means its not filtering records according to what i entered in txtname texbox .if i am entering some datas in all two textbox's then its showing filtered records . can anyone tell me the solution for this ? also i need how to change the filter expresion at runtime according to these textboxes values . Thanks in advance

    C 1 Reply Last reply
    0
    • M md_azy

      Hi, <asp:SqlDataSource ID="grid_source" runat="server" ConnectionString="Data Source=db;Initial Catalog=faq;User ID=sa;Password=mercury" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [c_empcode], [c_name], [c_designation], [c_department], [c_emailid], [c_reportingPerson], [c_passwd], [n_status] FROM [Employee_Mst] where n_deleted =0" OnSelecting="grid_source_Selecting" FilterExpression="c_name like '{0}%' and c_department like '{1}%' " > <FilterParameters> <asp:ControlParameter Name="c_name" ControlID="txtname" PropertyName="Text" /> <asp:ControlParameter Name="c_department" ControlID="txtdepart" PropertyName="Text" /> </FilterParameters> </asp:SqlDataSource> This is my sqldatasource in that i used filter expression for filtering data . if txtdepart textbox is empty means its not filtering records according to what i entered in txtname texbox .if i am entering some datas in all two textbox's then its showing filtered records . can anyone tell me the solution for this ? also i need how to change the filter expresion at runtime according to these textboxes values . Thanks in advance

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The SQLDataSource classes are not suitable for real world programming. If you're doing a professional project, you should not use them. What you're describing seems to me to be a bug in the classes tho, what have you turned up on google, I'd expect other people would have asked the same question.

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      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