Need a pros help

G

Guest

I have a datagrid with 3 columns

Name quantity status

This grid is populated from a sqldatareader.

grid.datasource = datareader
grid.databind()

I now want to set the quantity column to a template column with a
dropdownlist. How can
I get the dropdownlist to be populated from the same sqldatareader but start
a count from 1 to the value of the
quantity field, so if the foll data is returned


testproduct 5 open


the dropdownlist will have

1
2
3
4
5

for the first row so on.

Thanks
 
C

Curt_C [MVP]

I'd make the template column in two parts.
1) get all the values into the drop down, using the usual ways
2) loop the values and set the Selected=True when you his the right value.

That make sense? Dont try to think of it as one process, its really two.
A simple function call can set the selected item.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top