Creating the Data Lookup Page

Creating the Data Lookup Page

To create the data lookup page, follow these steps:

Open Visual Studio and create a new ASP.NET Web Forms project.

Add a new Web Form to the project by right-clicking the project in the Solution Explorer, selecting “Add” and then “Web Form”.

Name the Web Form “Lookup.aspx”.

Drag and drop a TextBox control onto the Web Form and name it “txtSearch”.

Drag and drop a Button control onto the Web Form and name it “btnSearch”.

Drag and drop a GridView control onto the Web Form and name it “gvResults”.

Open the Toolbox and navigate to the “AJAX Control Toolkit” section.

Drag and drop a ScriptManager control onto the Web Form.

Drag and drop an AutoCompleteExtender control onto the Web Form and set its properties as follows:

TargetControlID: txtSearch

ServiceMethod: “GetResults”

MinimumPrefixLength: 2 (or another value as needed)

CompletionSetCount: 10 (or another value as needed)

CompletionInterval: 1000 (or another value as needed)

Save the Web Form and build the project. Note: In order to use the AutoCompleteExtender control, you need to create a Web service that returns the search results based on the user’s input. The service method should take a string parameter (the user’s input) and return an array of strings (the search results). You can implement the service method in a separate Web service file or as a static method in the code-behind file of the Web Form. In either case, you need to decorate the service method with the [System.Web.Services.WebMethod] attribute and make sure that the Web service file or the code-behind file inherits from the System.Web.Services.WebService class.

Apply for ASP.NET Certification Now!!

https://www.vskills.in/certification/certified-aspnet-programmer

Back to Tutorial

Creating the Data Lookup Web Service
Enhancing a Text Box with the TextBoxWatermarkExtender

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?