Solved

Non-Dynamic DropDown List in Datagrid

Posted on 2006-10-24
3
303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

735 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