Click here to Skip to main content
16,018,264 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All


I have modal popup which is called inside the grid using Imagebutton.
The popup is called in the server side event imgView_OnCommand. but i get the popup twice.

XML
<asp:TemplateField HeaderText="Delete" ItemStyle-Width="12%" HeaderStyle-Width="12%">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="imgDelete" runat="server" ImageUrl="~/Images/delete1.jpg" Width="20px"
                                            Height="20px" OnClick="imgDelete_Click" OnCommand="imgDelete_Command" CommandArgument='<%# Eval("UserId") %>'
                                            CommandName="DeleteUser" />
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                </asp:TemplateField>



regards
froxy
Posted

You are firing the event twice.
The CommandName is being used by the grid to fire it's OnItemCommand event, while your ImageButton is firing the onClick handler as well, so if the same code is being executed for both events then you would get your popup twice.
 
Share this answer
 
Comments
froxy 6-Jul-11 10:39am    
i don't think i fire twice
Sergey Alexandrovich Kryukov 6-Jul-11 12:43pm    
Maybe not -- please check my advice.
--SA
Sergey Alexandrovich Kryukov 6-Jul-11 12:42pm    
My 5. I suggested how to resolve the problem, please see my solution.
--SA
There is no such event: imgView_OnCommand.

The fact you call this "event" is maybe the source of your confusion.

No wonder you deny you fire twice, but the facts show you do something twice. Maybe, this is not firing the event write but calling an event handler twice. It's relatively easy to resolve: put a break point inside the handler's body, run under debugger and examine the call stack. You will see where the redundant call came from.

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900