I've created a detailsview with regular textfield inputs. Below those regular inputs I have 1 dropdownlist, which I've added using templates.
I can access the regular fields using the "edit field" window (via smarttag) and then give a Datafieldname to that textfield. But there is no "Datafield' option for the dropdownlist.
How do I get the value of my dropdownlist to the function of my app-code class?
If you have any question about my reply, please let me know.
Best Regards,
Fei Han
DetailsViewasp
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
I bind a data source to DropDownList in DetailsView DataBound event.
Best Regards,
Fei Han
DetailsViewasp
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
1 Points
6 Posts
How to access value of dropdownlist in detailsview (template
Jan 07, 2015 02:15 PM|Ravar33|LINK
Hi
I've created a detailsview with regular textfield inputs. Below those regular inputs I have 1 dropdownlist, which I've added using templates.
I can access the regular fields using the "edit field" window (via smarttag) and then give a Datafieldname to that textfield. But there is no "Datafield' option for the dropdownlist.
How do I get the value of my dropdownlist to the function of my app-code class?
For pictures and the same question: http://stackoverflow.com/questions/27825739/how-to-access-value-of-dropdownlist-in-detailsview-template
DetailsView asp
All-Star
52683 Points
15720 Posts
Re: How to access value of dropdownlist in detailsview (template
Jan 07, 2015 08:48 PM|oned_gk|LINK
To bind ddl to detailsview datasource you can bind ddl selectedvalue property
SelectedValue = '<%# Bind("FK_RestaurantNr") %>'
To populate dropdown items, you can add ddldatasource then set datatextfield and datavaluefield
DetailsView asp
Suwandi - Non Graduate Programmer
All-Star
40565 Points
6233 Posts
Microsoft
Re: How to access value of dropdownlist in detailsview (template
Jan 08, 2015 01:55 AM|Fei Han - MSFT|LINK
Hi Ravar,
Thanks for your post.
You could refer to the following sample.
If you have any question about my reply, please let me know.
Best Regards,
Fei Han
DetailsView asp
Member
1 Points
6 Posts
Re: How to access value of dropdownlist in detailsview (template
Jan 08, 2015 02:06 PM|Ravar33|LINK
@oned_gk
Where should I put this? Can you give me a little bit more information please? :)
DetailsView asp
Member
1 Points
6 Posts
Re: How to access value of dropdownlist in detailsview (template
Jan 08, 2015 02:08 PM|Ravar33|LINK
This is my code at the moment:
DetailsView asp
Member
1 Points
6 Posts
Re: How to access value of dropdownlist in detailsview (template
Jan 08, 2015 02:09 PM|Ravar33|LINK
What does OnDataBound do exactly? I'm currently trying this, but an error occurs when I run this.
The error:
"ASP.AllRecensies_aspx doesn't contain a definition for DetailsView_Databound"
So what code should I put in "DetailsView_Databound"?
DetailsView asp
All-Star
40565 Points
6233 Posts
Microsoft
Re: How to access value of dropdownlist in detailsview (template
Jan 08, 2015 08:41 PM|Fei Han - MSFT|LINK
Hi Ravar,
I bind a data source to DropDownList in DetailsView DataBound event.
Best Regards,
Fei Han
DetailsView asp