Button inside repeater wont open modalpopup

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • semomaniz
    Recognized Expert New Member
    • Oct 2007
    • 210

    Button inside repeater wont open modalpopup

    I have a button inside a repeater which is supposed to open a popup when clicked. But when i click on the button my modalpopup does not open. The strange thing is on the code provided below if i replace the button with linkbutton every thing works fine and I have my popup dispalying. Is there a reason for the buttons to not function inside the repeater?

    Code:
    <asp:Repeater ID="myrep" runat="server" OnItemCommand="myrep_ItemCommand">
    	<HeaderTemplate>
    		<table border="0" cellpadding="2" cellspacing="2" width="100%">
    			<tr class="subaa1">
    				<td></td>
    				<td>Name</td>
    				<td>Address </td>				
    			</tr>                                
    	</HeaderTemplate>
    	<ItemTemplate>
    			<tr>
    				<td><asp:Button ID="btnassign" runat="server" Text="Assign" CommandName="ld" CommandArgument='<%#Eval("Lr") %>' /></td>
    				<td><%#Eval("abc") %></td>
    				<td><%#Eval("xsr") %></td>			
    			</tr>
    	</ItemTemplate>
    	<AlternatingItemTemplate>
    			 <tr>
    				<td><asp:Button ID="btnassign" runat="server" Text="Assign" CommandName="ld" CommandArgument='<%#Eval("Lr") %>' /></td>
    				<td><%#Eval("abc") %></td>
    				<td><%#Eval("xsr") %></td>			
    			</tr>
    	</AlternatingItemTemplate>
    	<FooterTemplate>
    		</table>
    	</FooterTemplate>
    </asp:Repeater>
    <asp:Button ID="btnhid1" runat="Server" style="display:none" />
    <asp:Panel ID="panassignment" runat="server" CssClass="modalPopup">
    <div runat="server" id="panheader">
    	<p><asp:LinkButton runat="server" ID="lnkclose" Text="Exit" /></p>
    	<p class="myheader">Assign Load :</p>
    </div>                           
    
    <div style="background-color:White">
    	 <p><strong>This is a test</strong></p>
    	
    </div>
    </asp:Panel>
    <cc2:ModalPopupExtender id="mpeassign" runat="server" TargetControlID="btnhid1" 
    	 PopupControlID="panassignment"  PopupDragHandleControlID="panheader" Drag="True" 
    	 BackgroundCssClass="modalBackground" CancelControlID="lnkclose" >
    </cc2:ModalPopupExtender>
    
    
    protected void myrep_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
    	if (e.CommandName.Equals("ld"))
    	{
    		mpeassign.Show();
    		
    	}
    	
    }
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    I'm not sure why but is it possibly because the button posts back to the server while the link does not...but rather simply runs the JavaScript when it's clicked on?

    Try adding "onclick="retur n false;" to the button and see what happens?

    -Frinny

    Comment

    Working...