Solved

How to create search function using Visual Web Developer 2005 Express Edition

Posted on 2006-06-22
13
372 Views
Last Modified: 2012-05-05
I have created a page in Visual Web Developer 2005 Express Edition that displays the contents of a Access database. I would like to add a text box on this page that users could enter a name and search the database, it has over 7,000 records. How can I do that with this IDE?  Also, I have a drop down that is populated with last names from the database. When you drop down the list you can see the names, but if you select one of the names the page just refreshes instead of showing you the selected name.  Any help would be great. Thanks.
0
Comment
Question by:valicon
  • 7
  • 4
13 Comments
 
LVL 7

Expert Comment

by:kGenius
ID: 16963519
for your first problem (filtering data in gridview) read this tutorial: http://www.exforsys.com/content/view/1652/265/

for your second problem add in code-behind in Page_Load procedure:
If Not Page.IsPostBack Then
  DropDownList1.DataBind
End If

in c#
if (! IsPostBack) {
   DropDownList1.DataBind();
}

hope this'll help
0
 
LVL 12

Author Comment

by:valicon
ID: 16968470
I went through the tutorial above and the query works when tested but when you enter a last name in the search box it does not work. Any idea on what is wrong?
0
 
LVL 12

Author Comment

by:valicon
ID: 16969447
I have got the search function working. However I do not see where to place the code you provided.
0
 
LVL 7

Expert Comment

by:kGenius
ID: 16970220
The code but be placed in code-behind (in your blabla.aspx.vb or blabla.aspx.cs file)
In VB.NET:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  If Not Page.IsPostBack Then
    DropDownList1.DataBind
  End If
End Sub

in C#
protected void Page_Load(Object sender, EventArgs e) {
  if (! IsPostBack) {
     DropDownList1.DataBind();
  }
}
0
 
LVL 12

Author Comment

by:valicon
ID: 16970594
Okay let me try that. Concerning the search is there any way to add soundex to it?
0
 
LVL 12

Author Comment

by:valicon
ID: 16970703
This is the only thing in the blabla.aspx.vb file:

Partial Class _Default
    Inherits System.Web.UI.Page

End Class

I placed the code in there but I received an error.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 7

Expert Comment

by:kGenius
ID: 16974210
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  If Not Page.IsPostBack Then
    DropDownList1.DataBind
  End If
End Sub

You must replace DropDownList1 with the ID of your DropDownList...

WHat error do you recieve? Can you be more specific?
0
 
LVL 12

Author Comment

by:valicon
ID: 16984709
I placed the above code into the .vb file and the error I received was:

Server Error in '/wwwroot' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30001: Statement is not valid in a namespace.

Source Error:

 

Line 9:  
Line 10:
Line 11: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 12:   If Not Page.IsPostBack Then
Line 13:     DropDownList1.DataBind
 

Source File: C:\Inetpub\wwwroot\Default.aspx.vb    Line: 11


Do you have any suggestions on adding soundex to the search function?
0
 
LVL 7

Expert Comment

by:kGenius
ID: 17010458
Be sure you add Protected Sub Päge_Load etc... in a class
eg:

Namespace YOURNAMESPACE
Public Class YOURCLASSNAME

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  If Not Page.IsPostBack Then
    DropDownList1.DataBind
  End If
End Sub

End Class

End Namespace
0
 
LVL 12

Author Comment

by:valicon
ID: 17050040
The only code in my default.aspx.vb file is:

Partial Class _Default
    Inherits System.Web.UI.Page

End Class


placing the above code has no effect...
0
 
LVL 12

Author Comment

by:valicon
ID: 17083511
Please close this question and refund points. I used and IDE and created the search function from within that program.
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 17118373
Closed, 500 points refunded.
Netminder
Site Admin
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now