Решение:

SOLUTION FOUND IN AN OTHER DISCUSSION :

Well, this is a known issue when you are using ButtonType of “Image” for the commandField to post the page twice.

<asp:CommandField ButtonType="Image" DeleteImageUrl="http://tango.freedesktop.org/static/cvs/tango-icon-theme/16x16/places/user-trash.png"
ShowDeleteButton="True" />

Using ButtonType="Link" will solve your problem.

Well, the reason for this is, of the three button types (Button, Image, Link) for the CommandField, the first two (Button and Image) are of “input” type (Button input, type = submit) , (Image input, type=submit) and the Link is anchor tag.

Both of the input controls will automatically cause the form that they reside within to be posted back to the server when they are clicked, whereas the anchor will not – instead it needs some javascript to cause a postback. This is where the problem is – all three html controls are rendered out with javascript attached to post the form back to the server on a click event, which allows buttons of type ‘Link’ to work correctly but causes buttons of type ‘Button’ and ‘Image’ to postback twice – the first time due to the javascript and the second because of the native postback.

My workaround for this problem is to use a TemplateField

<asp:TemplateField >
<ItemTemplate>
<asp:ImageButton id="DeleteButton" CommandName="Delete" ImageUrl="~/images/delete.ico" runat="server" />
</ItemTemplate>
</asp:TemplateField>

 

Опубликовано в ASP.NET