Solved

Non-Dynamic DropDown List in Datagrid

Posted on 2006-10-24
3
299 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 500 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now