Click here to Skip to main content
15,890,186 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: need help! Pin
Abhishek Sur27-Aug-09 22:23
professionalAbhishek Sur27-Aug-09 22:23 
QuestionHow would I handle an Error with this piece of code. Pin
solutionsville27-Aug-09 10:08
solutionsville27-Aug-09 10:08 
AnswerRe: How would I handle an Error with this piece of code. Pin
Robert_Pan27-Aug-09 14:40
Robert_Pan27-Aug-09 14:40 
Questionproblem rendering placeholder with user controls added to it Pin
dd31415927-Aug-09 9:56
dd31415927-Aug-09 9:56 
QuestionJavascript with multiple user controls Pin
dptalt27-Aug-09 9:30
dptalt27-Aug-09 9:30 
AnswerRe: Javascript with multiple user controls Pin
DoctorMick28-Aug-09 0:17
DoctorMick28-Aug-09 0:17 
GeneralRe: Javascript with multiple user controls Pin
dptalt28-Aug-09 3:49
dptalt28-Aug-09 3:49 
QuestionEvent Validation Pin
VengefulSakhmet27-Aug-09 9:21
VengefulSakhmet27-Aug-09 9:21 
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 Fundamentals", "Prof. Williams", "Apr 5 - Jun 26", "ClassDescriptions.aspx#Anchor4");
                t1.Rows.Add("Ports and Services", "Prof. Brown", "Oct 20 - Dec 5", "ClassDescriptions.aspx#Anchor5");                
                SQLQueryClassListings.DataSource = t1;
                SQLQueryClassListings.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
                       
    </script>
    
    <form id="form1" runat="server">
    <div>
        <img src="SimBLEND_logo_trans_SMALL.png" />
    <a href="main.aspx">Enter</a>
    </p>
    <br /><br /><br /><br/>
        <asp:GridView ID="SQLQueryClassListings" AutoGenerateColumns="false" runat="server" OnRowCommand="ClassGridView_RowCommand"
            BorderWidth="1px" BackColor="White" CellPadding="5" BorderColor="Black" RowStyle-BorderColor = "Black"
            HeaderStyle-BackColor="#0D69F2" HeaderStyle-ForeColor="White" AlternatingRowStyle-BackColor="#E8E8E8" HeaderStyle-BorderColor="Black" GridLines="Both">
            <Columns>
                <asp:BoundField HeaderText="Classes" DataField="LeafName" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="250" 
                    ItemStyle-BorderColor="#ADADAD" HeaderStyle-BorderColor ="Black"/>
                <asp:BoundField HeaderText="Teacher" DataField="TeacherName" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="200" 
                    ItemStyle-BorderColor="#ADADAD" HeaderStyle-BorderColor ="Black"/>
                <asp:BoundField HeaderText="Available" DataField="SemesterEnds" HeaderStyle-HorizontalAlign="Center"  
                    ItemStyle-HorizontalAlign ="Center" ItemStyle-Width="150" ItemStyle-BorderColor="#ADADAD" HeaderStyle-BorderColor ="Black"/>
                <asp:HyperLinkField HeaderText="Course Description & Career Tracks" DataNavigateUrlFields="ApplicableTracks" 
                    Text="See Description" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign ="Center" ItemStyle-BorderColor="#ADADAD" HeaderStyle-BorderColor ="Black"/>
                <asp:TemplateField  HeaderText="Register" HeaderStyle-BorderColor="Black" ItemStyle-BorderColor = "#ADADAD">
                    <ItemTemplate>
                        <asp:Button ID="Register" runat="server" CommandName="Register" Text="Register" 
                            OnClientClick="return confirm('You have sucessfully registered!')"/>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
</html>

QuestionWhich button pressed Pin
ffowler27-Aug-09 9:09
ffowler27-Aug-09 9:09 
AnswerRe: Which button pressed Pin
Abhijit Jana27-Aug-09 9:15
professionalAbhijit Jana27-Aug-09 9:15 
GeneralRe: Which button pressed Pin
ffowler27-Aug-09 9:20
ffowler27-Aug-09 9:20 
GeneralRe: Which button pressed Pin
Abhijit Jana27-Aug-09 9:51
professionalAbhijit Jana27-Aug-09 9:51 
GeneralRe: Which button pressed Pin
ffowler27-Aug-09 10:02
ffowler27-Aug-09 10:02 
GeneralRe: Which button pressed Pin
Abhijit Jana27-Aug-09 10:14
professionalAbhijit Jana27-Aug-09 10:14 
QuestionNeed Suggestion Pin
amarnath n.n27-Aug-09 6:05
amarnath n.n27-Aug-09 6:05 
AnswerRe: Need Suggestion Pin
Jay Royall27-Aug-09 6:26
Jay Royall27-Aug-09 6:26 
GeneralRe: Need Suggestion Pin
amarnath n.n27-Aug-09 13:21
amarnath n.n27-Aug-09 13:21 
GeneralRe: Need Suggestion Pin
N a v a n e e t h27-Aug-09 19:52
N a v a n e e t h27-Aug-09 19:52 
QuestionRetaining focus after postback Pin
rcampbell1227-Aug-09 6:04
rcampbell1227-Aug-09 6:04 
AnswerRe: Retaining focus after postback Pin
Jeremy Likness27-Aug-09 6:17
professionalJeremy Likness27-Aug-09 6:17 
GeneralRe: Retaining focus after postback Pin
rcampbell1227-Aug-09 6:33
rcampbell1227-Aug-09 6:33 
GeneralClient side validation is the way to go - Example given Pin
David Mujica27-Aug-09 7:43
David Mujica27-Aug-09 7:43 
Questionupload and download Pin
hasani200727-Aug-09 5:15
hasani200727-Aug-09 5:15 
AnswerRe: upload and download Pin
Abhishek Sur27-Aug-09 5:33
professionalAbhishek Sur27-Aug-09 5:33 
AnswerRe: upload and download Pin
Abhijit Jana27-Aug-09 9:20
professionalAbhijit Jana27-Aug-09 9:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.