Why would the same web form control render different "onclick" logic based on the page structure?
- by zk812
It was hard to title this question. :)
I have a user control that is used to display a list of lookup items in my database and a delete button for each item (Editor User Control below). The delete button has an onClientClick event used to display a confirmation dialog in JavaScript.
On page one, the confirmation pops up and functions correctly. The overall structure is:
Master Page
Page
Editor User Control
List of items with delete button
On page two, the confirmation pops up but regardless of the answer, the page posts back anyway. The structure of this page is:
Master Page
Page
User Control
Editor User Control
List of items with delete button
For some reason, this makes a difference in how the delete button is rendered.
Page one:
<input type="image" name="ctl00...RequestTypesDataList$ctl01$ctl01" src="Images/Disable.png" alt="Delete" onclick="return ProcessDeleteCommand(1);" />
Page two:
<input type="image" name="ctl00...RequestTypesDataList$ctl07$ctl01" src="Images/Disable.png" alt="Delete" onclick="return ProcessDeleteCommand(2);WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$RequestCreator1$RequestTypeEditor1$RequestTypesDataList$ctl07$ctl01", "", true, "", "", false, false))" />
Does anyone know why page two renders WebForm_DoPostBackWithOptions after my JS check? It's causing the postback regardless of the confirmation choice.