SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 313 Weeks Ago, 6 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 12 Dec 2017 My Price 10.00

input handling added to this page. (guestbook.aspx)

I need input validation added to these pages. Let me know if there are any questions

I need input handling added to this page. (guestbook.aspx)

 

 

aspx

 

 

 

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="guestbook.aspx.cs"Inherits="guestbook"%>

 

<!DOCTYPEhtml>

 

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title></title>

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:DataGridID="dg"runat="server">

</asp:DataGrid>

</div>

</form>

</body>

</html>

 

 

Aspx.cs

 

using System;

usingSystem.Collections.Generic;

usingSystem.Linq;

usingSystem.Web;

usingSystem.Web.UI;

usingSystem.Web.UI.WebControls;

 

publicpartialclassguestbook : System.Web.UI.Page

{

protectedvoidPage_Load(object sender, EventArgs e)

    {

 

    }

}

 

 

 

 

Here are some helpful hints

 

aspx.cs changes

    protected void insertRow(object o, EventArgs e)
    {
       
if (Page.IsValid == false) return; // NEED THIS LINE TO PREVENT INSERTING BAD DATA INTO THE DATABASE

.aspx changes:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="myguestbook.aspx.cs" Inherits="myguestbook" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DataGrid ID="dg" runat="server"></asp:DataGrid>
    </div>
   <asp:ValidationSummary runat="server" HeaderText="There were errors on the page:" />
    <asp:RequiredFieldValidator runat="server"
        ControlToValidate="txName"
        ErrorMessage="Name is required."> *
    </asp:RequiredFieldValidator>   
    Name: <input type="text" id="txName" runat="server" />
    <asp:RegularExpressionValidator runat="server" display="Dynamic"
     ControlToValidate ="txName"
     ErrorMessage="Name must be one or more letters only (<40)"
     ValidationExpression="[A-Za-z ]{1,40}" />
    <br />
    <asp:RequiredFieldValidator runat="server"
        ControlToValidate="txAge"
        ErrorMessage="Age is required."> *
    </asp:RequiredFieldValidator>   
    Age: <input type="text" id="txAge" runat="server" />
    <asp:RegularExpressionValidator runat="server" display="Dynamic"
     ControlToValidate ="txAge"
     ErrorMessage="Age must be only numbers"
     ValidationExpression="[0-9]{1,3}" />
    <br />

    <asp:RequiredFieldValidator runat="server"
        ControlToValidate="txComment"
        ErrorMessage="Comment is required."> *
    </asp:RequiredFieldValidator>   
    Comment: <input type="text" id="txComment" runat="server" />
    <asp:RegularExpressionValidator runat="server" display="Dynamic"
     ControlToValidate ="txComment"
     ErrorMessage="Comment can only contain letters and spaces (<80)"
     ValidationExpression="[A-Za-z ]{1,80}" />
    <br />
    <input type="button" value="Insert" onserverclick="insertRow" runat="server" />
    </form>
</body>
</html>

 

Attachments:

Answers

(5)
Status NEW Posted 12 Dec 2017 12:12 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)