Solved

Non-Dynamic DropDown List in Datagrid

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

11 Experts available now in Live!

Get 1:1 Help Now