Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Non-Dynamic DropDown List in Datagrid

Posted on 2006-10-24
3
Medium Priority
?
309 Views
Last Modified: 2006-11-18
Experts,

I have a datagrid with a dropdown list / text box (in template columns) as well as an update / delete button.  The dropdownlist is a simple non-dynamic listing of numbers (1 - 100 - essentially an order list).  The numbers have been inserted in a static fasion and as such are not coming from any database.

What I do need to do is somehow make the dropdownlist for each record display the selected database value so that the user can update the order list accordingly.  To do this, I have set the SelectedIndex='<%# container.DataItem("ChapterOrder")%>' for this otherwise static dropdown.  This seems to select values, but they are always off (a number or so above / below the real value).

When I select a value for a record listed in the dropdown list and then press the save button, the right number (the selected number) is being correctly inserted into the SQL database, but is not properly being represented after a page refresh, revisit or re-load.

Any thoughts as to how one can display the selected database item in a static dropdown in a datagrid?
0
Comment
Question by:w3lgi
3 Comments
 
LVL 12

Accepted Solution

by:
Pra4444 earned 2000 total points
ID: 17798373
try using SelectedValue property instead of SelectedIndex
0
 
LVL 12

Expert Comment

by:craskin
ID: 17798800
indexes start at 0

your values seem to start at 1
0
 

Author Comment

by:w3lgi
ID: 17799805
That did it; thanks a million!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question