[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

dropdownlist within a datagrid - programatically setting the selectedindex when page loads and after an update button pressed

Posted on 2005-04-06
2
Medium Priority
?
506 Views
Last Modified: 2008-01-09
Hi,

I am sure this is done all the time, but I am relatively new to ASP.NET (PLEASE NOTE: project also contains considerable VB.NET - I'd rather have as little on the HTML page and as much code in the .vb files as possible).

We have 3 drop down list's within a datagrid each with different information in them.
All rows within the datagrid are editable.
At the moment it is a static number of rows (15).

What I need to be able to do, is when we load from a table into the grid (binding a dataset) and load from another table into the combo boxes using DataSource="<%# BindCostCentre() %>" on the HTML page (where bindcostcentre code in .vb returns Return cmdCommand.ExecuteReader(CommandBehavior.CloseConnection)) the lists need to be set to a default (based on a value I can retrieve in the database).

EG the list might contain:
Project A
Project B
Project C
Project D
Each row loads from the database via code in the .vb which is already written and working, however the combo box is always defaulting to the first list item, I need it to point to different items depending on which row it is on.
EG
Row 1's drop down needs to point to Project C
Row 2's drop down needs to point to Project B

Basically I need to assign selectedindex on a per row basis on page load/bind for the combo boxes.

Hope this isn't too confusing, but please ask questions if it is.
Thanks for your help,
Brian.
0
Comment
Question by:brianb99999
2 Comments
 
LVL 11

Accepted Solution

by:
sachiek earned 2000 total points
ID: 13723361
You can set to particular listitem in dropdown list in datagrid's ItemDatabound event by findind particular dropdown controls using find control method.

Sachi
0
 
LVL 5

Author Comment

by:brianb99999
ID: 13723495
Sachi your a Saint  - thanks

Brian.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
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…
Suggested Courses
Course of the Month18 days, 3 hours left to enroll

830 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