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. adding dropdownlist to details view.

adding dropdownlist to details view.

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasevisual-studiohelpquestion
4 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.
  • C Offline
    C Offline
    chubbie
    wrote on last edited by
    #1

    hi all.. here's the situation. i am using microsoft visual studio 2005.. and i need some help here. can i add dropdownlist with data extracted from database to detailview..? if so, mind telling me the proceedure/steps about doing it..? cox i cant find relevant info on this.. thanks so much for your help.:) -DarkangeL-

    M 1 Reply Last reply
    0
    • C chubbie

      hi all.. here's the situation. i am using microsoft visual studio 2005.. and i need some help here. can i add dropdownlist with data extracted from database to detailview..? if so, mind telling me the proceedure/steps about doing it..? cox i cant find relevant info on this.. thanks so much for your help.:) -DarkangeL-

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      chubbie wrote:

      can i add dropdownlist with data extracted from database to detailview..?

      Yes, you can.

      chubbie wrote:

      if so, mind telling me the proceedure/steps about doing it..?

      You basically use the TemplateField[^] declared in the Fields collection of the DetailsView[^] control. Depending on when you want to use the dropdownlist, you can place the dropdownlist in the ItemTemplate or EditItemTemplate of the Template field. Also you can use a web data source control to bind data to the DropDownList control, or provide code to do that.

      C 1 Reply Last reply
      0
      • M minhpc_bk

        chubbie wrote:

        can i add dropdownlist with data extracted from database to detailview..?

        Yes, you can.

        chubbie wrote:

        if so, mind telling me the proceedure/steps about doing it..?

        You basically use the TemplateField[^] declared in the Fields collection of the DetailsView[^] control. Depending on when you want to use the dropdownlist, you can place the dropdownlist in the ItemTemplate or EditItemTemplate of the Template field. Also you can use a web data source control to bind data to the DropDownList control, or provide code to do that.

        C Offline
        C Offline
        chubbie
        wrote on last edited by
        #3

        i have 3 detailsView, namely detailsView1, detailsView2 and detailsView3. detailsView1 is for viewing (paging purposes). detailsView2 is for Editing. detailsVIew3 is for Inserting. detailsView2 and detailsView3 share the same 4 columns in the table at database. 3 of which are required to have dropdownlist.. 2 of the 3 are interlink with each other.. so, how to implement/incorporate the dropdownlists into the detailsViews? you've told me about the ItemTemplate and EditItemTemplate.. but i still have no idea.. mind giving me the procedure/ step-by-step..? thanks. -DarkangeL- -- modified at 20:11 Tuesday 17th January, 2006

        M 1 Reply Last reply
        0
        • C chubbie

          i have 3 detailsView, namely detailsView1, detailsView2 and detailsView3. detailsView1 is for viewing (paging purposes). detailsView2 is for Editing. detailsVIew3 is for Inserting. detailsView2 and detailsView3 share the same 4 columns in the table at database. 3 of which are required to have dropdownlist.. 2 of the 3 are interlink with each other.. so, how to implement/incorporate the dropdownlists into the detailsViews? you've told me about the ItemTemplate and EditItemTemplate.. but i still have no idea.. mind giving me the procedure/ step-by-step..? thanks. -DarkangeL- -- modified at 20:11 Tuesday 17th January, 2006

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          Hi there, Using 3 DetailsView control sounds redundant to to me since you can use a single DetailsView control to do for all of these purposes. If you want to display data in the Master/Details pattern, then you might consider using the GridView control with the DetailsView control. So IMO your first issue is to choose the right control to implement the functionality. Then you should read the doccumentation/sample code of that control to see how to use it and how to customize in the way you want. With the DetailsView control, you basically define how data is displayed in the Fields area, there are a couple of buitl-in fields in the ASP.NET 2.0. Among of them the Template field is your choice since it allows you to customize the UI of the field. If you want to use the DropDownList control when displaying data, then you simply declare the DropDownList control in the ItemTemplate of the TemplateField. Your second step should be to choose a way to bind data fetched from BD to the dropdownlist. Well, there are basically two common way to bind data to a control. One option is to declaratively use a web data source control and you simply specify the datasource control in the DataSourceID property of the DropDownList. Another option is to bind data to the dropdownlist in code. For more information on these two options, you should have a look at some links provided in my other posts, or follow the links below: http://msdn.microsoft.com/library/en-us/dnvs05/html/GrdDetView.asp[^] http://msdn.microsoft.com/library/en-us/dnaspp/html/GridViewEx.asp[^] Small tip: If you want to notify somebody about the changes you made in your post, you'd better start a new thread if the created time of your post is significant.

          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