Solved

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

Posted on 2006-06-22
13
379 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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
 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Login 17 51
encoding an href string 2 21
Object Oriented Programming, C#, referencing, scoping. 13 48
asp.net input html code have it display the content 2 14
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

825 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