Click here to Skip to main content
16,020,633 members
Please Sign up or sign in to vote.
3.40/5 (2 votes)
See more:
Hi for everyone! I have a problem with a itemtemplate in a gridview, i have 3 ImageButton and one method that called Img_Command here´s my asp.net code:
C#
<asp:TemplateField>">

   <ItemTemplate>

   <asp:ImageButton ID="imgBtnUpload" OnCommand="Img_Command" CommandName="Upload" 
   ToolTip="Enviar PDA – PDR" ImageUrl="~/Images/APUpload.png" Visible="true" runat="server"/>

   <asp:ImageButton ID="imgBtnProcessado" OnCommand="Img_Command" CommandName="Processado" ToolTip="Lote já processado!" ImageUrl="~/Images/loteProcessado.png"   Visible="false"runat="server"/>

   </ItemTemplate>

</asp:TemplateField>">

and here´s my code behind:
C#
protected void Img_Command(object sender, CommandEventArgs eArgs)
        {
            GridView gdv = (GridView)sender;
            switch (eArgs.CommandName)
            {
                case "Atualizar":
                    break;
                case "Upload":
                    BtnUpload(0);
                    break;
                case "Processado":
                    break;
            }

        }

Why the OnCommand event is not firing?

Any suggest?

Thanks!
Posted
Updated 8-Aug-13 2:59am
v2
Comments
Ankur\m/ 8-Aug-13 8:48am    
Check the designer code if the delegate code is generated there. I would suggest generate the code again in designer mode and make the necessary changes.
AlexDuzi 8-Aug-13 9:07am    
Hi Ankur! I will check the designer code! thanks for the advise!

1 solution

Hi guys, i have solved this!

I put:
EnableEventValidation=

in the page.

Thanks,

Duzi.
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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