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

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

Using search engine with GridView

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :ASP.Net

Hi guys,

I'm binding database with GridView by SQLDataSource. Now if I want to search based on one of the database column (for e.g. search by date), how can I do it? 

View Complete Post

More Related Resource Links

Extreme ASP.NET: Search Engine Optimization with ASP.NET 4.0, Visual Studio 2010 and IIS7


In this article, the author takes a look at SEO practices that the reader can apply when using the latest Microsoft Web technologies.

Scott Allen

MSDN Magazine September 2009

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?

How to create search engine in MVC

Hi I'm using EF and MVC for the first time and I need some strategy hints.  I have a list of skill sets (ID + Name) which I need to make searchable from a textbox. Then in a seperate step I need to find all people with those skill sets. What's a smart way of doing this? I've been thinking about having two listboxes bound to multiselect lists and then moving records from one listbox to the other. I did that in ASP once, but have no idea of how to do it in MVC.   Re Dennis

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.  

Search for Gridview on Eventhandler

Hello, I was woundering if there is a way to seach for a gridview on event handler.? I have three gridviews in which i can insert from and on my insertbutton codebehind, I want to check the gridview i am using so i could get the datakeynames for insert into the database. Does anyone have ideas. Thaks  

search option in gridview

I am creating small application.  I want to keep textbox and gridview. If i type any alphabets in text box like customers name  if i type a it should display customers name with starting a in gridview. plz help methanq.

how to move to particular pageindex in gridview when i search

 Hi, I have one textbox one button and one gridview on my webform, when Page loads all records are displayed on gridview, which works perfectly fine, Now,I search particular records by entering id in textbox, which finds particular records and found row's background becomes red.which works perfectly fine too, my gridview's pagesize is 15 which means it display 15 records per page,   Now,Problem is when i enter ID textbox to search record,but searched record is on another page,so,I want that When i click button to search, the page must be displayed where searched record exist. It displays first page even after search, How can i move to that page where record exist.   what i have to code in click event Regards,ASIF

Image Search Engine

Any idea or concept how will I able to create an Image Search Engine? It is about using an Image and search similar images on web. Thanks for your help. :)

Using search with stored procedure and redisplaying in one gridview

I am using two SQL Data Adapters to initially populate a gridview and then repopulate from search results.  The Search SQL Data Source uses a stored procedure to retrieve the results but I cannot get the updated gridview to display. Here is my aspx code:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>All Reqeusts Data View and Editing Page</title> </head> <body> <form id="form1" runat="server"> <div> </div> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:SqlDataSource ID="AllRequestsSearchSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:artworkrequestsConnectionString %>" SelectCommand="artworksearch" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="BeginDat

Filtering with gridview + (search function)

      have a gridview and  6 dropdownlists which I want to use to filter data in gridview I am using this code below Try            strSql = "Select * from aspnet_Users where UserName = " & Me.DropDownList1.SelectedItem.Text            Call OpenConnection()            Call GiveCommand(strSql)            sqlMyCmd.ExecuteNonQuery()            Me.GridView1.DataSource = sqlMyCmd.ExecuteReader            Me.GridView1.DataBind()            Call EndConnect()        Catch ex As InvalidOperationException        Catch ex2 As SqlException        Catch ex As NullReferenceException        End Try what im trying to acheive on the page is to allow user to pick a value from any1 of the 6 dropdownlist (representing  6 fields) and when btnSearch is clicked Gridview displays the data the code I have above allows me to do this with one dropdown

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

create a search engine



Can anyone show me where it teraches how to create a search engine in the web app? I need to create a search field and have it access and search my websites database. Also, is it possible to do with any kind of Database language? 

Localization through Session and Localization through URL (so the search engine works with different


I also followed this tutorial:http://www.alebo.de/2009/03/localization-with-aspnet-mvc-using-routing/
apart from nothing happening, I also find it odd that I have
to register ALL my pages in the global. asax and have to rewrite ALL my
link in order to have the language identifier in my URL.


does someone have an example of his/her global.asax and how the addiional route handling has been added?

Search an in a GridView



I would like to add a trigger to the UpdatePanel, the control is an ImageButton in a gridView like this:

                                <asp:TemplateField HeaderText="" ShowHeader="False">
                                    <%--<HeaderStyle Wrap="False" Width="25px" />--%>
                                    <ItemStyle HorizontalAlign="Left" Wrap="False" Width="25px" />
                                        <asp:ImageButton ID="imgDetalle" runat="server" CausesValidation="false" CommandName="VerDocumento"
                                            ImageUrl="~/imagesExterna/icoDetalle.gif" CommandArgument='<%# Eval("NOMBRE_DOCUMENTO") %>'
                                            ToolTip="Ver Documento" />
                                    <ItemStyle HorizontalAlign="center" Wrap="False" />

How can I add in codeBehind the trigger?? my code is this but

Search Engine for website


I need to create a search engine for my website that searches my entire content and files stored in a database.

What is the best way and easy to accomplish this?

If can, please provide a few samples or links.

Code must be in c#.


Search GridView and update the row that was found


 I have a gridview that populates from a sqlDataSource

I added a textBox and a button to input company name in a textBox and click the button to search. Once the row with company is found I want to update it, but when I click update in this row, the gridview displays all of the rows, and instead of the one from the search results, the first row at the top is displayed in update template.

The GridView first is populated from a static sqlDataSource (EditDistributor), that displays all of the columns in a table.

                SelectCommand="SELECT [company], [d_address], [country], [phone], Email, [ddate], [distr_id] FROM [distributors]" 
                UpdateCommand="UPDATE [distributors] SET [company] = @company, [d_address] = @d_address, [country] = @country, [phone] = @phone, Email = @email, [ddate] = @ddate WHERE [distr_id] = @distr_id">


Then in this click event I call a StoredProcedure:

Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click

        EditDistributor.SelectCommandType = SqlDataSourceCommandType.StoredProcedure

Gridview Search Error


I want to give search functionality in grid view. To implement this i am following the below link


but I am getting following error

The name 'MSCD' does not exist in the current context

Iam using the following code

if (MSCD.Utilities.Validation.IsDateTime(_newValue) == true)


                    DateTime dtValue = DateTime.Parse(_newValue);

                    _newValue = sfield + " " + _operator + " #" + dtValue.ToShortDateString() + "#";


Can anyone tell me why iam getting this error and what is the use of this MSCD.Utilities.Validation sysntax

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