Question: (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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!