Declined
Last Updated: 29 May 2015 18:00 by ADMIN
ADMIN
Slav
Created on: 11 Apr 2014 11:36
Category: Rotator
Type: Bug Report
0
Exception is thrown when a standard ImageButton or a standard Button with UseSubmitBehavior="true" is placed in a rotator item and it triggers a postback
An exception will be thrown when there is a a standard ImageButton or a standard Button with UseSubmitBehavior="true" in the ItemTemplate of a RadRotator and it triggers a postback.
1 comment
ADMIN
Niko
Posted on: 29 May 2015 18:00
This is not really a bug, but an incorrect way of using ASP.NET. 

Please, note that binding a Repeater in the same way will produce the same result. 

This error is discussed here: http://stackoverflow.com/questions/228969/invalid-postback-or-callback-argument-event-validation-is-enabled-using-page

Looks like this is a feature, not a bug as MSDN describes - https://msdn.microsoft.com/en-us/library/system.web.ui.page.enableeventvalidation(v=vs.110).aspx

What happens is that controls that initiated the postback - the buttons in the item template, are not present in the Controls tree and the Event Validation fails. These controls will only appear at Page_Load, which is already late in the page lifecycle.

There are basically a couple of ways to handle this:
 - bind on Page_Init
 - prevent bind when doing a postback - the infamous if(!IsPostBack)

Regards,
Niko