1

I want to get the ID of the Command-button on repeater that has been clicked in posted data on a server when it has been click.

When I check the posted data it is something like this:

ctl00$ctl00$MainContentPlaceHolder$MainContentPlaceHolder$lvEstates$ctl00$MainContentPlaceHolder_MainContentPlaceHolder_lvEstates_ctl00_colEdit_cmd.x = 7 ctl00$ctl00$MainContentPlaceHolder$MainContentPlaceHolder$lvEstates$ctl00$MainContentPlaceHolder_MainContentPlaceHolder_lvEstates_ctl00_colEdit_cmd.y=9

Why does it show in X and Y? How can I find which item was clicked?

It was the first item in repeater and the column was 15 (zero based).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Pouya Samie
  • 3,718
  • 1
  • 21
  • 34
  • The ID is generated by the place the control has/gets in the control-hierarchy when the page is build; meaning you'll see something like that. You shouldn't put logic in the naming of a control because when you change the page structure, the ID can change. Instead I would use the Command Name and/or the Command Argument on the control and read that out from your OnItemCommand on your Repeaters postback function. – Allan S. Hansen Jun 06 '16 at 05:57
  • thank you for your reply for some reason i want to catch it on init and get the id of clicked command so is there any way to find out the id with this information?! – Pouya Samie Jun 06 '16 at 06:17
  • You should be able to find it in the Request.Form collection, and then parse it from there. – Allan S. Hansen Jun 06 '16 at 06:18
  • it's exactly what's in Request.Form collection – Pouya Samie Jun 06 '16 at 06:24

0 Answers0