2010-05-13 5 views
1

단추가 중계기 안에 있습니다. ModalPopupExtender는 각 단추의 이벤트를 확인하는 데 사용됩니다. 리피터 외부에 표준 패널을 만들고 리피터 안의 각 패널에 리피터의 각 버튼을 연결합니다. 문제는 팝업에서 버튼을 눌렀을 때입니다. 어떤 버튼을 눌렀는지 식별 할 수 없으므로 편집 할 행을 결정하는 방법을 알 수 없습니다. 패널 :ModalPopupExtender를 사용할 때 중계기에서 특정 단추를 누를 방법

<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> 

리피터 :

<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"/> 
... 

이벤트 핸들 :

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 

답변

0

난 당신이 클라이언트 클릭에 편집중인 행의 값을 가진 숨겨진 입력을 설정합니다 javascript를 사용하고 처리기에서 해당 변수를 요청하면 편집중인 행이됩니다.

0

CommandArgument에 전화 번호와 같은 행에 고유 한 항목을 지정하지 않는 이유는 무엇입니까?

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

그런 다음 당신은 당신의 핸들러의 CommandEventArgs에 액세스 할 수 있습니다

당신은 행의 인덱스를 원하는 예 경우.

+0

이 명령은 모달 패널에서 사용할 수 없기 때문에 해당 버튼을 클릭하면 모달 다이얼로그가 열리고 다른 버튼을 클릭하면 계속 진행됩니다. Cammand arg는 두 번째 버튼에서 어떻게 설정해야하는지 알 수 있지만 이벤트가 발생하기 전까지는 값을 알 수 없습니다. – NomadicDeveloper

관련 문제