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