Do not use on any
shared computer
August 29, 2008 09:08pm pdt
 
[x]
Attachment Details

Using a DropDownList in a Datagrid for editing a field

Tags: datagrid, dropdownlist, dropdown
I have a Bound GridView in a webpage.  I want the user to be able to select the Call Result from a dropdown box inside the grid.
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Programming
Question Asked By: RDWaibel
Solution Provided By: davehunt00
Participating Experts: 2
Solution Grade: B
Views: 87
Translate:
Loading Advertisement...
 
[+][-]Accepted Solution by davehunt00
Accepted Solution by davehunt00:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by RDWaibel
Author Comment by RDWaibel:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Open Discussion
Open Discussion
 
Comment by AmyQuigg
RBWaibel,

Did you receive a solution for your problem?  I'm wanting to do the same thing!

Thanks!
 
 
Comment by RDWaibel
honestly, no  :(
I ended up doing it the 'old' fashion way with ASP.  I know it can be done, I am just not clear as to how.
 
 
Comment by AmyQuigg
i figured out how!!!  :)
this is based on the assumption that you have an ObjectDataSource tied to the datagrid that is populating your datagrid.

this is what you need to do:
inside the datagrid, remove the bound column that you want to put the dropdownlist inside.  Then, insert a template field (I named it the same as my column that I was replacing so it would be easy to know which Template i was refering to).

Close the fields modification window, and click on "Edit Templates".

Once there, choose the template that you just created by clicking on the drop-down menu and the "Column[x] - TemplateName".  This will open up all views from the template.

--To display the value from the database--
Then, under "Item Template", place a label,  Then click on the arrow and choose "Edit DataBindings".  From there, you should be able to bind the Text to the column you're pulling from the database.    If you only have "Custom Binding" link available, you may have to use the code : Bind("ColumnName").  Otherwise you should be able to click on "Field Binding" and choose the field that way.

--To insert the dropDownList
Under "EditItemTemplate" drag and drop a dropDownList.  Click on the arrow and choose "Edit DataBindings", and choose the exact same column you chose for the label.  Then click on "Edit Items" and enter in your items you want the user to choose from!

Hope that helps!
 
 
Comment by AmyQuigg
also...if you want to populate the dropdownList from the database, then instead of Edit Items, click on "Choose Data Source" and follow the wizard...that will populate the dropDownList from the database instead of the "Edit Items" method!  :)
 
 
20080723-EE-VQP-34 / EE_QW_2_20070628