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. General Programming
  3. LINQ
  4. Dropdown list ,pass parameter in linq........

Dropdown list ,pass parameter in linq........

Scheduled Pinned Locked Moved LINQ
csharpdatabaselinqhelptutorial
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.
  • P Offline
    P Offline
    pranavcool
    wrote on last edited by
    #1

    Hi, I am new to .net 3.5. Currently i am stuck up in middle of the project. I have got two dropdownlist.One is country and other is region. Based on the country (first dropdownlist) the values in the region (second dropdownlist) should get populated. I have already written a linq query to bind country dropdownlist, but based on the country selected, region dropdownlost should be populated. Now my query is that how to pass the value in to the linq query to populate the region dropdown base on the country selected from the dropdownlost. suggestion would be appreciated. Waiting for an early reply. Regards,

    Pranav Dave

    J 1 Reply Last reply
    0
    • P pranavcool

      Hi, I am new to .net 3.5. Currently i am stuck up in middle of the project. I have got two dropdownlist.One is country and other is region. Based on the country (first dropdownlist) the values in the region (second dropdownlist) should get populated. I have already written a linq query to bind country dropdownlist, but based on the country selected, region dropdownlost should be populated. Now my query is that how to pass the value in to the linq query to populate the region dropdown base on the country selected from the dropdownlost. suggestion would be appreciated. Waiting for an early reply. Regards,

      Pranav Dave

      J Offline
      J Offline
      Jon Rista
      wrote on last edited by
      #2

      string country = ddlCountry.SelectedValue;

      IEnumerable regions = from reg in db.Regions
      where reg.Country == country
      orderby reg.Name
      select reg;

      ddlRegions.DataSource = regions;
      ddlRegions.DataBind();

      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