ASP.Net - Adding User Controls to DataGrid

G

Guest

Instead of button columns, I need to add a column of dropdownlists to my
datagrid, with options such as ADD, EDIT, and DELETE to each row of data. How
can I do that?

Thanks,

Richard
 
G

Guest

I have added a template column of dropdownlist to the datagrid, with 2
options ("No Change" and "Delete") on each dropdownlist. "No Change" is
selected by default during design time.

The user will mark the grid items to delete by selecting the "Delete"
option. The user can then click the DELETE button (not on the datagrid, but
on the form) to delete all marked grid items in one batch.

I am trying to loop thru grid items to build SQL DELETE query, by checking
the following:

Dim lcboAction As DropDownList
lcboAction =
CType(Me.gridDisplay.Items(lnIndex).Cells(0).Controls(0).FindControl("cboAction"), DropDownList)

However, lcboAction.SelectedValue always equals to "No Change" even for the
ones I have marked as "Delete". Why? Am I missing something here?

Thanks in advance,

Richard
 

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

Top