473,321 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Error on post back

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
Jan 9 '06 #1
2 1186
if the problem is with the validation, have you tryed to set it to off?
enableEventValidation="false"

Jan 9 '06 #2
No, but given that it's set to true for security reasons and I would like to
make use of the feature it provides, I did not want to set it to false.

I would rather know why the ClientScript.RegisterForEventValidation is not
working like I understand it should.

Thanks
Wayne
"Henrique Mello" <hm****@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
if the problem is with the validation, have you tryed to set it to off?
enableEventValidation="false"

Jan 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: RodBillett | last post by:
Using SmartNavigation. Windows2003 Server Framework 1.0 (3705) IIS6 and I have IIS configured to utilize the 1.0 framework. Any Ideas why I would be getting the following jscript error within...
1
by: Michael | last post by:
Hi, Any one know the problem of the following error: Thanks, m Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
7
by: Martin Strojek | last post by:
Hi, I have the following problem with developing some web site. I use Visual Studio 2003 to build a website. I tried Windows 2003 Server and switched now back to Windows XP with PWS but the...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.