views:

26

answers:

2

I have buttons contained within a repeater. A ModalPopupExtender is used to confirm event for each button. I create standard panels outside of the repeater and I attach each button in the repeater to these panels from inside the repeater. The problem is once the button is pressed in the popup I can't figure out how to determine which row of the repeater to edit as I can't figure out how to identify which button was pressed. Panel:

<asp:Panel ID="pnlRemoveAlert" runat="server" >
<h1 align="center">Remove Phone</h1>
<asp:Button ID="butRemove" runat="server" OnCommand="Handle_Click" CommandName="Remove" Text="Continue"/>
<asp:Button ID="butRemoveCancel" runat="server" Text="Cancel"/>
</asp:Panel>

Repeater:

<asp:Repeater ID="repPhoneNumbers" runat="server" OnItemDataBound="setButtonModals"> 
<ItemTemplate>
...
<asp:Button ID="btnStatus" runat="server"/>
<asp:Button ID="dummybutton" runat="Server" Visible="false" /> 
<ajaxToolkit:ModalPopupExtender ID="mpeEnable" runat="server" TargetControlID = "btnStatus 
  CancelControlID="butEnableCancel"
  PopupControlID="pnlEnableAlert"/>
...

Event Handle:

Protected Sub Handle_Click(ByVal sender As Object, ByVal e As CommandEventArgs)
'I need to know which row of the repeater to deal with here
End Sub
A: 

I would set a hidden input with the value of the row that you're editing on client click using javascript and then on the handler just request that variable and that's the row you're editing.

Avitus
A: 

Why not just assign a CommandArgument with something unique to that row like the phone number ID or something?

Eg if you want the index of the row:

<asp:Button ID="btnStatus" runat="server"
    CommandArgument="<%# Container.ItemIndex.ToString() %>" />

Then you can access it in your handler's CommandEventArgs.

Kelsey
Because that commandarg will not be available from the modal panel. When you click that button it will open the modaldialog and from there you will click another button to continue. The Cammand arg would have to some how be set in the second button but the value would be unknown until the event.
MemphisDeveloper