Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Non-Dynamic DropDown List in Datagrid

Posted on 2006-10-24
3
Medium Priority
?
306 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

722 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