.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Simple search TextBox in asp.net

Posted By: miya2008     Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
The article Simple search TextBox in asp.net was added by miya2008 on Monday, August 09, 2010.

I create a simple search textbox in asp.net with the help of LIKE operator (SQL)Step 1 :- First we create a table in database:->create table textsearch(id int identity( 1,1),fname varchar(50),lname varchar(50))Step 2:- In aspx page,I use the following

View Complete Post

More Related Resource Links

search textbox with search keyword inside?



how to make a search txtbox that includes the search keyword and when the user clicks the search keyword disappears

thanks for the help

search multiple words into textbox and populate all records in gridview related those keywords


I have a textbox and a gridview which is bound to a table

what I want to achieve is a solution where lets say there are two records - e.g. "1. Book and 2. Red", i want a user to type in those words and the gridview shows the results as followed;

1. Book

2. Red

I have set up the sql data source and everything and my like operator is this...

LIKE '%' + @record + '%'

how can I solve this problem?

gridview filtering using a codebehind (textbox + search button)

i am trying to replicate the following sequence: input text into text box > press search button > search a database using LIKE operator > display using a gridview or listview. this sequence is fairly easy to do using the drag and drop then sqldatasource options, but i am trying to do the same result using a codebehind.  here is my code:   ____________________________________________________________________________________________________________ SqlConnection myConn; myConn = new SqlConnection(@"Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\projectDB.mdf; Integrated Security=True;User Instance=True"); myConn.Open(); string strSQL; strSQL = "SELECT * FROM Message";       //strSQL = "SELECT * FROM Message WHERE Message LIKE '" + txtSearch.Text + "'"; SqlDataAdapter da = new SqlDataAdapter(strSQL, myConn); DataSet ds = new DataSet(); da.Fill(ds, "Message"); GridView1.DataSource = ds; GridView1.DataBind(); myConn.Close(); _____________________________________________________________________________________________________________  now, if I use this code inside a page_load event, it does work. if I put it inside a button_click event i get nothing. i am mystified by this.. any help? why can't i use a button to display my gridview1 when i'm using a code behind.  

How can i place windows textbox on taskbar like desktop search

Hi How can i place windows textbox on taskbar like desktop search thanks

Need help with configuring simple search - Getting 404 Error


I am trying to setup search such that I have 3 scopes: This Site, All Sites, and People. I have got to this point by selecting "Use custom scopes. Display richer results using the following Search Center: /SearchCenter/Pages" in Site Settings > Search Settings - Then, when I search on All Sites or People, I get a 404 Not Found. Does this mean I have to create some sort of Search site (aka SearchCenter)?

Please advise.

Make the AutoCompleteExtender more like the Netflix search textbox


I am using the autocompleteextender control in a project I am working on for a client, but I would like to be able to match words in the middle of the data I am searching. Controls such as the search textbox on sites like Netflix do this. For example, if I go to Netflix and search for 'wolfman' I get results like:

The Wolfman

The Real Wolfman

House of the Wolfman

With the extender I would only get results beginning with 'wolfman'. If my stored procedure in my webservice is written to do search the text as I want, nothing shows in the extender (I'm guessing because so many top results don't begin with the entered text). Is there a way to get the autocompleteextender to behave more like this?


Need help with simple database search



Ive got a textbox and a button. When I type a name of a customer I want to perform a search in my database and display the result as a table. I cant find anything on google that shows me how to do this.

Some of you got any examples of how to do this with ADO.net?

I want to filter the gridview on textchange in search textbox....


hi friends...
i want to filter the gridview on textchange in search textbox....
if i press "a" the gridview should filled up with record starting with "a". i have some code

SqlDataSource1.SelectCommand = "select * from DeptMaster where DeptName like '" + TextBox1.Text + "%'";
        SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.Text;
        GridView1.DataSource = SqlDataSource1;

its working while leaving the textbox but i want this code should execute on keypress event....

How to search a bound ListBox from a TextBox



I am just starting out with WPF and so please pardon me if I ask very ignorant questions but I'm finding WPF quite an up-hill struggle! 

I have created a fairly simple app that has a Listbox to the left that is bound to a DataTable to an OLEDB datasource. Above this Listbox there is a Textbox. What I am trying to do is use the Texbox as search/filter on the bound Listbox. Currently I can click inside the Listbox and start typing and it works perfectly well in finding the most appropriate Item with the IsTextSearchEnabled=True. I want to mimic this functionality but in the Textbox. Is this possible? Here is the xmal:

<Window x:Class="Test.WPF.BasicContactSearch1.ContactWindow"
    Title="Contact Window" Height="480" Width="640"
    xmlns:local="clr-namespace:Test.WPF.BasicContactSearch1" Loaded="Window_Loaded">
  <DockPanel Width="auto" Height="auto" Margin="8 8 8 8">
    <Border Height="56" HorizontalAlignment="Stretch" VerticalAlignment="Top" BorderThickness="1" CornerRadius="8" DockPanel.Dock="Top" Backgroun

Help with simple search


I have built a very simple ASP.NET MVC application that shows a series of articles from a SQL database and allows you to filter them using a simple query on the headline. However I'm having some difficulty showing the number of articles on the page/the query they searched.

For example:

You have searched for 'INSERT QUERY' and retured 20 results

I have looked at using the count method like <% Model.Count(); %> but it always returns nothing? But in addition to this I also need to only show this message if the user has done a search because I am using the same View for both the initial Index and the Search Results. I'm guessing this require some kind of If and Else statement to get it working, but I'm unsure how best to go about this as I'm new to ASP.NET and need a bit of guidance to point me in the right direction.

Here is my code for my Controller and my View for the Index so you can see how my application works.

EDIT: I'm also looking at showing a link back to search results if a user has viewed an article direct from the results instead of the main list, I'm presuming I can use a similar solution as with the hiding and showing of the message on the results using an if and else statement.

Simple search with drop down menu to choose which column to search on?


Hi - just getting back in to web development after several years away from it (and the last time I did this it was classic ASP, help!).

Basically using Microsoft web developer 2010 to do a simple search against a db. I have one textbox and one drop down menu (which will be used to choose which column in the db to search against).

I have the textbox only search working but don't know how to implement the dropdown menu part?

Code so far (the drop down has just been added to the form here nothing more):

Really appreciate any help thanks:

<%@ Page Language=&quot;VB&quot; AutoEventWireup=&quot;false&quot; CodeFile=&quot;Default.aspx.vb&quot; Inherits=&quot;Bield_Projects_Telephone_Default&quot; %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Moss Simple Search not searching new items in list until keyword is "propertyName:Keyword" i.e Custo



Problem : Simple search not showing the new items created in list. It shows the new items if searched with keyword as  "propertyName:Keyword" i.e CustomeName:John

There is a metadata property "CustomerName", which is mapped to a custom column(Customer Name) in a sharepoint list as ows_CustomerName(Text). Also there is a scope(Customers) created which has folder set to URL of the sharepoint site containing this list.

The items are indexed for sure as they are searchable if simple search keyword is  "propertyName:Keyword" i.e CustomeName:"John Smith" . But not searchable if the keyword is John Smith

Is there anything missing??

Textbox Editable GridView in ASP.NET

This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.

Highlighting Rows with TextBox OnFocus

In another article I explained that how you can make the rows of the GridView control clickable and highlight them when they are clicked. In this article I will explain that how you can highlight the GridView rows when you focus on the TextBox which is contained inside the GridView control.

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

Creating a Simple Class in C#

The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

A Simple and Extensible Radio Button Style GridView

The GridView is one of the significant controls in ASP.NET 2.0 and later versions. No doubt it reduces a lot of work time. However, customizing the GridView control is not an easy task. For example, it's hard to add a radio button column to the GridView. This article demonstrates the reason why a radio button column cannot act as normal and how to create a simple and extensible radio button GridView.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend