Event Validation
-
I am trying to have the button in my gridview create a popup when clicked. I receive this error during runtime after I select "Ok" in the popup. 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. If I make enableEventValidation false, it runs fine, but that's not a secure way to do it. While performing a google search they allude to there being another way, but do not elaborate. Any ideas?
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<style type="text/css">
body
{
background-color: #CCF0FF;
font-family: Verdana, Arial, Helvetica, Sans-Serif;
font-size: small;
color: Black;
margin-top: 50px;
margin-left: 60px;
margin-right:50px;
border-color: Black;
}
p
{
text-align:right;
}
</style>
<title>Register for Classes</title>
</head>
<body><script runat="server"> public string ConnectionPath; public string register = "Register"; protected void Page\_Load(object sender, EventArgs e) { try { System.Data.DataTable t1 = new System.Data.DataTable(); t1.Columns.Add("LeafName"); t1.Columns.Add("TeacherName"); t1.Columns.Add("SemesterEnds"); t1.Columns.Add("ApplicableTracks"); t1.Rows.Add("Nmap Basics", "Prof. Zhang", "Aug 23 - Nov 3", "ClassDescriptions.aspx#Anchor1"); t1.Rows.Add("Nmap Advanced", "Prof. Scmidt", "Oct 20 - Dec 5", "ClassDescriptions.aspx#Anchor2"); t1.Rows.Add("Nmap Advanced II", "Prof. Strauss", "Jan 5 - Mar 27", "ClassDescriptions.aspx#Anchor3"); t1.Rows.Add("Firewall and Router Fundamen