Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to determine which table row fired an event 1

Status
Not open for further replies.

EDB2

MIS
Sep 11, 2002
36
US
I have an asp:table with 2 columns. Col 1 holds an employee number, and col 2 holds a drop-down list of codes.

If the user selects a new code from the drop-down list, the SelectedIndexChanged event fires and, within that event, I can look at the SelectedValue to see what the new code is - but how do I know what table row I'm on? How do I reference back to the table from within the SelectedIndexChanged event to determine the row number that fired the event?
 
Why do you want to do this? Do you have multiple rows with a ddl in each row? If so, then you have to have a unique name for each control. If you need to know the row for some reason, then use a gridview, repeater ..etc.
 
Yes, I do have multiple rows with a ddl in each row. The repeater looks like it might be a good solution, thanks for the push in the right (hopefully!) direction
 
Just as an update, I finally got this to work by taking the easy way out. The table was being created dynamically so I just appended the row number to the ddl ID, then substringed it out in the SelectedIndexChanged routine so I knew what row to reference in table.row(index).cell(index).text to get the other values I needed.

thanks again jbenson!
 
Glad you got it working, but I would still suggest looking in to the objects I suggested. Once you learn how they work, it will make doing what you are doing much easier.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top