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. bind data in ASP.NET

bind data in ASP.NET

Scheduled Pinned Locked Moved ASP.NET
questioncsharphtmlasp-netwpf
6 Posts 3 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
    MrMicrosoftvn
    wrote on last edited by
    #1

    Hello, I get a problem in my project when binding data from the DataSource. Here is it: Well, i have 2 tables as below: Categories: ============== CategoryID CategoryName Products: ============== ProductID CategoryID ProductName That is, now i would like to bind data so that i get the HTML Source like this: <select name="Product"> NameOfFirstCategory NameOfFirstProductInTheFirstCategory NameOfSecondProductInTheFirstCategory NameOfSecondCategory NameOfFirstProductInSecondCategory NameOfSecondProductInSecondCategory my question is that is there available control that can do that or what ASP.NET server control should i use ? and ... plz show me a code example of it. thanks a lot !!!

    S L 3 Replies Last reply
    0
    • M MrMicrosoftvn

      Hello, I get a problem in my project when binding data from the DataSource. Here is it: Well, i have 2 tables as below: Categories: ============== CategoryID CategoryName Products: ============== ProductID CategoryID ProductName That is, now i would like to bind data so that i get the HTML Source like this: <select name="Product"> NameOfFirstCategory NameOfFirstProductInTheFirstCategory NameOfSecondProductInTheFirstCategory NameOfSecondCategory NameOfFirstProductInSecondCategory NameOfSecondProductInSecondCategory my question is that is there available control that can do that or what ASP.NET server control should i use ? and ... plz show me a code example of it. thanks a lot !!!

      S Offline
      S Offline
      Sarvesvara BVKS Dasa
      wrote on last edited by
      #2

      drpList.DataSource = ds drpList.DataTextField = "FIELD1" drpList.DataValueField = "FIELD2" where, ds - is the dataset containing the desired data drpList - ID for the 'SELECT' list FIELD1, FIELD2 - name of the field of the table He who controls others may be powerful,
      But he who has mastered himself is mightier still.

      M 1 Reply Last reply
      0
      • S Sarvesvara BVKS Dasa

        drpList.DataSource = ds drpList.DataTextField = "FIELD1" drpList.DataValueField = "FIELD2" where, ds - is the dataset containing the desired data drpList - ID for the 'SELECT' list FIELD1, FIELD2 - name of the field of the table He who controls others may be powerful,
        But he who has mastered himself is mightier still.

        M Offline
        M Offline
        MrMicrosoftvn
        wrote on last edited by
        #3

        thansk for you answer but i think you read my question carelessly. That does not solve my problem and not that i got

        1 Reply Last reply
        0
        • M MrMicrosoftvn

          Hello, I get a problem in my project when binding data from the DataSource. Here is it: Well, i have 2 tables as below: Categories: ============== CategoryID CategoryName Products: ============== ProductID CategoryID ProductName That is, now i would like to bind data so that i get the HTML Source like this: <select name="Product"> NameOfFirstCategory NameOfFirstProductInTheFirstCategory NameOfSecondProductInTheFirstCategory NameOfSecondCategory NameOfFirstProductInSecondCategory NameOfSecondProductInSecondCategory my question is that is there available control that can do that or what ASP.NET server control should i use ? and ... plz show me a code example of it. thanks a lot !!!

          S Offline
          S Offline
          Sarvesvara BVKS Dasa
          wrote on last edited by
          #4

          MrMicrosoftvn wrote: my question is that is there available control that can do that or what ASP.NET server control should i use ? and ... plz show me a code example of it. Please explai me what you want!!! He who controls others may be powerful,
          But he who has mastered himself is mightier still.

          1 Reply Last reply
          0
          • M MrMicrosoftvn

            Hello, I get a problem in my project when binding data from the DataSource. Here is it: Well, i have 2 tables as below: Categories: ============== CategoryID CategoryName Products: ============== ProductID CategoryID ProductName That is, now i would like to bind data so that i get the HTML Source like this: <select name="Product"> NameOfFirstCategory NameOfFirstProductInTheFirstCategory NameOfSecondProductInTheFirstCategory NameOfSecondCategory NameOfFirstProductInSecondCategory NameOfSecondProductInSecondCategory my question is that is there available control that can do that or what ASP.NET server control should i use ? and ... plz show me a code example of it. thanks a lot !!!

            L Offline
            L Offline
            lionli215
            wrote on last edited by
            #5

            Yes.I know what do you want. I think you can't use "DataBind" directly.Here you will use "Item.Add" add your DropDownList items.In your CodeBehind file you will do this.And this will get to your points. Want this to help.Good luck!

            M 1 Reply Last reply
            0
            • L lionli215

              Yes.I know what do you want. I think you can't use "DataBind" directly.Here you will use "Item.Add" add your DropDownList items.In your CodeBehind file you will do this.And this will get to your points. Want this to help.Good luck!

              M Offline
              M Offline
              MrMicrosoftvn
              wrote on last edited by
              #6

              yes, i can not use "DataBind" directly to bind my data to DropDownlist in that case. Well, i will try yr way. Thanks !!!

              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