Solved

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

Posted on 2006-06-22
13
375 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Handle null when using linq in this line 1 26
Different Delete Messages 7 37
Replace &lt; with < 14 54
Adware on IIS hosted asp.net website 1 13
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

919 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

18 Experts available now in Live!

Get 1:1 Help Now