Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2006-06-22
13
Medium Priority
?
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

604 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