Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Web App development with ASP.NET in C#) Create a web-based Address book. Display the address books contents in a GridView. Allow the user to search

(Web App development with ASP.NET in C#) Create a web-based Address book. Display the address books contents in a GridView. Allow the user to search for entries with a particular last name. Trying to do this and I get multitude of errors, any help will be appreciated, thank you!

The default.aspx code is:

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;

namespace MyWebForm { public partial class _Default : Page { protected void Page_Load(object sender, EventArgs e) {

} private void rep_bind() { connection(); string query = "select * from customer where Name like'" + TextBox1.Text + "%'";

SqlDataAdapter da = new SqlDataAdapter(query, con); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); }

protected void Button1_Click(object sender, EventArgs e) { if (dr.HasRows) } dr.Read();

rep_bind(); GridView1.Visible = true;

TextBox1.Text = ""; Label1.Text = ""; } else { GridView1.Visible = false; Label1.Visable = true; Label1.Text = "The search Term " + TextBox1.Text + " Is Not Available in the Record"; }

The Default.aspx.designer code is:

//------------------------------------------------------------------------------ // // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------

namespace MyWebForm { public partial class _Default { ///

/// form1 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; /// /// TextBox1 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox TextBox1; /// /// Button1 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button Button1; /// /// Label2 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label Label2; /// /// GridView1 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.GridView GridView1; /// /// SqlDataSource1 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.SqlDataSource SqlDataSource1; } }

The database is a sql and is connected already to the table as seen here:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

How flying airoplane?

Answered: 1 week ago