asp.net combo in datagrid

G

Guest

Hi All

I Have a datagrid on asp.net.
i need to add a combo box column that chages it's data
according to a spefiiec row in a datagrid.
Please help me ??

Thnaks
Ziv Riezman
 
G

Guest

Hi

Thanks for the replay, can you be more specific about your answer, I'm using the combo in a template column, and setting the data source to a function on the asp page, how can this function know which row currently being updated ?
Or if using your solution please give some more information,

Thnaks in advnace
 
E

Eliyahu Goldin

Ziv,

You can use template columns to have a column with a combobox. And you can
use ItemDataBound event to populate the combobox with the data from the row.

Eliyahu
 
G

Guest

Hi Again

First I'm using a dropdownlist, second the dropdownlist should be populated every row with different datasource depanding on value stored in the current row in a different column for example DB_Grip has column A and column B (DropDownList)
Column B on every row should have different values depending on the value in Column A

Thanks for the help


Thnaks for the help
 
E

Eliyahu Goldin

Ziv,

Looks like you are almost on the right track. What are you using as a
combobox? A DropDownList? What DataSource are you setting to a function?

In any case, I don't think you can databind the control you are using as a
combo, since you want to populate it from a datagrid row and not from any
separate data source. I think you can achieve what you want much easier in
ItemDataBound event. The event gets a parameter that contains a reference
to the datagrid item that is being databound. You should filter out the
header, the footer and process only data items. Data item is a data row from
your table. It contains a collection of cells. So, you have access to all
the cells on the current row. You can populate the combo control out of the
cell values.

Eliyahu

Ziv Riezman said:
Hi

Thanks for the replay, can you be more specific about your answer, I'm
using the combo in a template column, and setting the data source to a
function on the asp page, how can this function know which row currently
being updated ?
 

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

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top