Design .aspx page, having 4 Textboxes (First name, Last name, Email and Mobile). Place a button on the page. On the click even of the button user will be redirected on another page, having same 4 Textboxes having AutoComplete capability. On another page user do not have type First name, Last name, Email, and Mobile number but it will be AutoComplete by pressing one or two keys in each textbox.
Loading

Sam HobbsRank #107 · 20.5K reputationPosted Jul 4, 2023, 5:12 PM EDT
This is a class assignment, correct? The best way to help you is to help you figure it out yourself. What have you done so far? Is there something specific you need help with?
Deepak RawatRank #646 · 3.7K reputationPosted Jul 5, 2023, 1:02 AM EDT
Create the first page (Default.aspx):
Add the button click event handler:
protected void btnSubmit_Click(object sender, EventArgs e) { string firstName = txtFirstName.Text; string lastName = txtLastName.Text; string email = txtEmail.Text; string mobile = txtMobile.Text; // Store the values in session or pass them as query parameters Session["FirstName"] = firstName; Session["LastName"] = lastName; Session["Email"] = email; Session["Mobile"] = mobile; // Redirect to the second page Response.Redirect("SecondPage.aspx"); }Create the second page (SecondPage.aspx):
Implement autocomplete functionality:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Retrieve the values from the session or query parameters set in the previous page string firstName = Session["FirstName"] as string; string lastName = Session["LastName"] as string; string email = Session["Email"] as string; string mobile = Session["Mobile"] as string; // Set the values in the textboxes txtFirstName.Text = firstName; txtLastName.Text = lastName; txtEmail.Text = email; txtMobile.Text = mobile; } }Make sure to set the
AutoPostBackproperty of the button totrueif you want the page to perform a postback when the button is clicked.Amit MohantyRank #112 · 20K reputationPosted Jul 5, 2023, 2:18 AM EDT
FirstPage.aspx:
FirstPage.aspx.cs (code-behind):
using System; namespace YourNamespace { public partial class FirstPage : System.Web.UI.Page { protected void btnRedirect_Click(object sender, EventArgs e) { Response.Redirect("SecondPage.aspx" + "?FirstName=" + txtFirstName.Text + "&LastName=" + txtLastName.Text + "&Email=" + txtEmail.Text + "&Mobile=" + txtMobile.Text); } } }SecondPage.aspx:
SecondPage.aspx.cs (code-behind):
using System; namespace YourNamespace { public partial class SecondPage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string firstName = Request.QueryString["FirstName"]; string lastName = Request.QueryString["LastName"]; string email = Request.QueryString["Email"]; string mobile = Request.QueryString["Mobile"]; txtFirstName.Text = firstName; txtLastName.Text = lastName; txtEmail.Text = email; txtMobile.Text = mobile; } } } }