Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Event Validation

Event Validation

Scheduled Pinned Locked Moved ASP.NET
csharphtmlcsssysadminsecurity
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VengefulSakhmet
    wrote on last edited by
    #1

    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
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups