W
Wayne Sepega
I have two drop downs on my web form. The contents of DropDown2 depends on
what is currently selected in DropDown1. I use client side java script to
re-populate DropDown2 whenever DropDown1 changes.
In doing so, if I select a value in DropDown2 that wasn't there when the
page was built I receive the following error:
Exception Details: System.ArgumentException: 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.
I have tried doing the following:
protected override void Render(HtmlTextWriter writer)
{
DateTime curDate;
int dateCount = br.MaxPickUpDateDays + br.MaxExpirationDays;
if (subscription.ExpirationDate <= DateTime.Now.Date)
ClientScript.RegisterForEventValidation("DropDown2",
subscription.ExpirationDate.ToString(DateFormat));
for (int i = 0; i < dateCount; i++)
{
curDate = System.DateTime.Now.AddDays(i).Date;
ClientScript.RegisterForEventValidation("DropDown2",
curDate.ToString(DateFormat));
}
base.Render(writer);
}
However, when I do the above my DropDown2.SelectedValue always comes back
blank.
I've spent about an hr or so working on this and searching google, but all
the examples I find give me back a blank selected value. A point in the
right direction or some suggestions would be appreciated.
Thanks
Wayne Sepega
what is currently selected in DropDown1. I use client side java script to
re-populate DropDown2 whenever DropDown1 changes.
In doing so, if I select a value in DropDown2 that wasn't there when the
page was built I receive the following error:
Exception Details: System.ArgumentException: 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.
I have tried doing the following:
protected override void Render(HtmlTextWriter writer)
{
DateTime curDate;
int dateCount = br.MaxPickUpDateDays + br.MaxExpirationDays;
if (subscription.ExpirationDate <= DateTime.Now.Date)
ClientScript.RegisterForEventValidation("DropDown2",
subscription.ExpirationDate.ToString(DateFormat));
for (int i = 0; i < dateCount; i++)
{
curDate = System.DateTime.Now.AddDays(i).Date;
ClientScript.RegisterForEventValidation("DropDown2",
curDate.ToString(DateFormat));
}
base.Render(writer);
}
However, when I do the above my DropDown2.SelectedValue always comes back
blank.
I've spent about an hr or so working on this and searching google, but all
the examples I find give me back a blank selected value. A point in the
right direction or some suggestions would be appreciated.
Thanks
Wayne Sepega