making this work with ajax

6 views
Skip to first unread message

lynn

unread,
Mar 19, 2011, 3:08:20 PM3/19/11
to aspnetcontroladapters
Just a note.

Even though I'm on .net 4, there are still some things that I need
control adapters for (ahem, wrapping the label tag around the input
tag for touch screen applications), and the source code is quite
lovely as a jumping off point!

Just wanted to document though that in my AJAX implementation I had to
add:

protected override void RenderContents(System.Web.UI.HtmlTextWriter
writer)
{
if (this.Page != null)
{
foreach (ListItem i in this.AdaptedControl.Items)
{

Page.ClientScript.RegisterForEventValidation(this.AdaptedControl.UniqueID,
i.Value);
}
}
base.RenderContents(writer);
}

to the adapter class (RadioButtonList in my case) to stop:
Exception type: ArgumentException
Exception message: Invalid postback or callback argument. Event
validation is enabled using <pages enableEventValidation="true"/> in
configuration or <%@ Page EnableEventValidation="true" %> in a page.
For security purposes, this feature verifies that arguments to
postback or callback events originate from the server control that
originally rendered them. If the data is valid and expected, use the
ClientScriptManager.RegisterForEventValidation method in order to
register the postback or callback data for validation.
at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId,
String argument)
Reply all
Reply to author
Forward
0 new messages