DataGrid DropDownList proble

B

BJF

How do you know what row you're getting changes for? Here's the issue:

- It's a web application
- I have a dropdown list in a column of my datagrid. The datagrid does
AutoPostBack.
- The dropdown list is defined in an ItemTemplate, not an EditItemTemplate.
This is inside a TemplateColumn.
- I databind it to a DataTable. All the data shows up as expected, the
DropDownList is set to the proper value, and has the proper items available
for selection in its list available for selection.
- When the user selects a new value for one of the dropdownlists, the page
is redisplayed (correctly) with the changed value in the dropdownlist
control. In the event handler for the SelectedIndexChanged event I can
determine the SelectedIndex for the newly selected item in the dropdownlist.
So far, so good. (I find it interesting that, although the
SelectedIndexChanged event is the one for the DataGrid, the 'sender' the
event handler receives is the DropDownList object, not the DataGrid object.)

What I can't determine is what row this particular DropDownList belongs
to.

Now, every example I've seen shows edited controls in an
EditItemTemplate instead of an ItemTemplate, and it may be that this is the
source of my problem. But these examples also require a click of an Edit
link to show the EditItemTemplate instead of the ItemTemplate. My goal is
to eliminate the need for this mouse click by just having the DropDownList
show up in the ItemTemplate.
Everything is working except the inability to know which row is being
affected.

Does anyone know how to do this, or if it's even possible?

Thanks in advance,
Ben Furino
(e-mail address removed)
 

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,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top