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. DB Query in AJAX

DB Query in AJAX

Scheduled Pinned Locked Moved ASP.NET
databasecsharpasp-nettutorial
9 Posts 4 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.
  • U Offline
    U Offline
    Usharva
    wrote on last edited by
    #1

    Hi Friends, i have two dropdowns- one to fill Country Names from Country table and the other one fills the State Names from State table CountryId is foreign key in State table When i select the Country name from country dropdown i want to fill States of that country in state dropdown. this is my query "select State_Id,State_name from State where country_id ='" & ddlCountry.selectedValue & "'" How to do this in AJAX in ASP.Net application can you send sample code thanks in advance

    N S V 3 Replies Last reply
    0
    • U Usharva

      Hi Friends, i have two dropdowns- one to fill Country Names from Country table and the other one fills the State Names from State table CountryId is foreign key in State table When i select the Country name from country dropdown i want to fill States of that country in state dropdown. this is my query "select State_Id,State_name from State where country_id ='" & ddlCountry.selectedValue & "'" How to do this in AJAX in ASP.Net application can you send sample code thanks in advance

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      I assume you are using AJAX toolkit. If so put your dropdowns inside update panel.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      U 1 Reply Last reply
      0
      • N N a v a n e e t h

        I assume you are using AJAX toolkit. If so put your dropdowns inside update panel.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

        U Offline
        U Offline
        Usharva
        wrote on last edited by
        #3

        thanks Navaneeth we need to give Autopostback is true in AJAX also?? because i have given the below code but SelectedIndexChanged Event of the ddlCountry is not Triggering This is my html code <asp:UpdatePanel ID="UpdatePanel1" runat="server"> </asp:UpdatePanel> <asp:DropDownList ID="ddlCountry" runat="server" > </asp:DropDownList> <asp:DropDownList ID="ddlState" runat="server"> </asp:DropDownList> I tried to give dropdowns inside UpdatePanel but its showing error like "Type 'System.Web.UI.UpdatePanel' does not have a public property named 'DropDownList'"

        1 Reply Last reply
        0
        • U Usharva

          Hi Friends, i have two dropdowns- one to fill Country Names from Country table and the other one fills the State Names from State table CountryId is foreign key in State table When i select the Country name from country dropdown i want to fill States of that country in state dropdown. this is my query "select State_Id,State_name from State where country_id ='" & ddlCountry.selectedValue & "'" How to do this in AJAX in ASP.Net application can you send sample code thanks in advance

          S Offline
          S Offline
          Sun Rays
          wrote on last edited by
          #4

          Hi, put your both Dropdown in Update Panel and Set Autopost back property true for first Dropdown. Hopen it will help you.

          Thanks, Sun Rays To get something you must have to try once. My Articles

          U 1 Reply Last reply
          0
          • S Sun Rays

            Hi, put your both Dropdown in Update Panel and Set Autopost back property true for first Dropdown. Hopen it will help you.

            Thanks, Sun Rays To get something you must have to try once. My Articles

            U Offline
            U Offline
            Usharva
            wrote on last edited by
            #5

            I tried but its giving the same error

            S 1 Reply Last reply
            0
            • U Usharva

              I tried but its giving the same error

              S Offline
              S Offline
              Sun Rays
              wrote on last edited by
              #6

              Hi, what error you are getting. Plz describe so can help you properly.. :)

              Thanks, Sun Rays To get something you must have to try once. My Articles

              U 1 Reply Last reply
              0
              • S Sun Rays

                Hi, what error you are getting. Plz describe so can help you properly.. :)

                Thanks, Sun Rays To get something you must have to try once. My Articles

                U Offline
                U Offline
                Usharva
                wrote on last edited by
                #7

                This is my html code <asp:UpdatePanel ID="UpdatePanel1" runat="server"> </asp:UpdatePanel> <asp:DropDownList ID="ddlCountry" runat="server" > </asp:DropDownList> <asp:DropDownList ID="ddlState" runat="server"> </asp:DropDownList> when i give dropdowns inside UpdatePanel its showing error like "Type 'System.Web.UI.UpdatePanel' does not have a public property named 'DropDownList'"

                1 Reply Last reply
                0
                • U Usharva

                  Hi Friends, i have two dropdowns- one to fill Country Names from Country table and the other one fills the State Names from State table CountryId is foreign key in State table When i select the Country name from country dropdown i want to fill States of that country in state dropdown. this is my query "select State_Id,State_name from State where country_id ='" & ddlCountry.selectedValue & "'" How to do this in AJAX in ASP.Net application can you send sample code thanks in advance

                  V Offline
                  V Offline
                  Vasudevan Deepak Kumar
                  wrote on last edited by
                  #8

                  Check this out: http://www.interspire.com/content/articles/33/3/3-Practical-Uses-For-AJAX[^]

                  Vasudevan Deepak Kumar Personal Homepage
                  Tech Gossips
                  A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

                  U 1 Reply Last reply
                  0
                  • V Vasudevan Deepak Kumar

                    Check this out: http://www.interspire.com/content/articles/33/3/3-Practical-Uses-For-AJAX[^]

                    Vasudevan Deepak Kumar Personal Homepage
                    Tech Gossips
                    A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

                    U Offline
                    U Offline
                    Usharva
                    wrote on last edited by
                    #9

                    Thank you Deepak, I refered that link but in that, Country and State are hardcoded (Storing in Array) but my requirment is I should get from DataBase. I searched in Google but i dint get sample code using Database.. please guide me

                    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