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. fill data in datagrid basing on conditin

fill data in datagrid basing on conditin

Scheduled Pinned Locked Moved ASP.NET
databasehelptutorial
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.
  • K Offline
    K Offline
    K R Neelima
    wrote on last edited by
    #1

    Hi! i have taken one datagrid & filled data basing on the query mentioned in the OLEDBDATAADAPTER wizard from Data Tab in the Toolbox.No problem its working.Bt the problem is "i want to fill the data in datagrid basing on some condition like //where branchid="textbox1.text" // Please suggest me .... how to make query in oledbdataadapter wizard...to fill data basing on condition Neelima

    K 1 Reply Last reply
    0
    • K K R Neelima

      Hi! i have taken one datagrid & filled data basing on the query mentioned in the OLEDBDATAADAPTER wizard from Data Tab in the Toolbox.No problem its working.Bt the problem is "i want to fill the data in datagrid basing on some condition like //where branchid="textbox1.text" // Please suggest me .... how to make query in oledbdataadapter wizard...to fill data basing on condition Neelima

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      I would go ahead and leave all the data in the DataTable. Then you can take the DataView from the DataTable and filter it. So in C# it would be: DataView dv = yourDataTable.DefaultView; dv.RowFilter = "branchid = " + textbox1.Text; vb.net dim dv as DataView = yourDataTable.DefaultView dv.RowFilter = "branchid = " + textbox1.Text Then when you set your datasource and your datagrid you set it to the dv var you have created. Then do a DataBind on the datagrid. The only other option is to pass a parameter into your command object to limit the rows coming back from the database. Hope that helps. Ben

      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