Решение:

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.

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

Если вам понравилась статья, помогите, пожалуйста с распространением этого материала в Сети.

Подпишитесь на наши новости

Добавить комментарий

Ваш e-mail не будет опубликован.

Этот сайт использует Akismet для борьбы со спамом. Узнайте как обрабатываются ваши данные комментариев.