Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Sir, This is Sandhya from india. I did my MCA and finally working as a Junior Programmer on .Net Platform.

I have Many Doubts in .Net Platform. Please help me one by one I need to clear it and i want to learn it perfectly.


I have a textbox and a gridview on my page. I need to search the data like Google.

Suppose if i press one letter S from keyboard it must show all the records of S.

and also i need Water mark extender inside Textbox as Search.


Please Please help me this problem and give me complete code.

Thankuuuuuuuuuuuuuuuuuuuuu.
Posted

Just Google for auto-extender or jquery auto-complete you will find many useful links

ASP.NET Suggester - Auto-complete Control[^]
 
Share this answer
 
Comments
Sandhya Lovely 24-Apr-12 5:41am    
Sir, Iam Unable to Understand. Please please can u post me the Design and code pages.
 
Share this answer
 
Comments
Sandhya Lovely 24-Apr-12 5:41am    
Sir, Iam Unable to Understand. Please please can u post me the Design and code pages.
uspatel 24-Apr-12 8:08am    
I think nobody can provide you a complete code here,But they can help you much if you try something and face any problem.
see one more link
http://www.codeproject.com/Articles/201099/AutoComplete-With-DataBase-and-AjaxControlToolkit
Hi Sandhya,
Its very hard and very much time consuming to give the COMPLETE CODE.
But Here I am giving you the Logic For your Search Provider.

For the search provider, You just need to connect with SQL Server and get the data from following command:

SQL
SELECT * FROM Persons
WHERE City LIKE 'TextBox.Text'


for AutoSuggestion in TextBox, see the following article:


ASP.NET Suggester - Auto-complete Control[^]

and as far as watermark is Concern, see the link below:

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/TextBoxWatermark/TextBoxWatermark.aspx[^]
 
Share this answer
 
v2
Comments
Sandhya Lovely 24-Apr-12 5:21am    
Sir,ur code is SELECT * FROM Persons
WHERE City LIKE 'TextBox.Text'
BUT I have Many Columns to search as......First Name, LastName,UserName, Country
and how to search all this ? please answer me
Sandhya Lovely 24-Apr-12 5:42am    
Sir, Iam Unable to Understand. Please please can u post me the Design and code pages.
Vipin_Arora 25-Apr-12 8:22am    
your email ID?
Please check this is what you want i think

http://datatables.net/release-datatables/examples/basic_init/multi_col_sort.html[^]

this link show you an example

you can download the code and modify according to your need..
 
Share this answer
 
Comments
Syed SufiyanUddin 24-Apr-12 7:03am    
Boss this is correct what i want BUT where i should write this code.
Syed SufiyanUddin 24-Apr-12 7:05am    
hello, where should we write this code.
Anuj Banka 24-Apr-12 7:05am    
You just have to add jquery files..And need to bind your control from database.You can download the source code for this example which will help you.
Syed SufiyanUddin 24-Apr-12 7:14am    
please am unable to understand, please can u tell step by step
Anuj Banka 24-Apr-12 7:15am    
give me your email ID i will send you the demo code run it debug it then find it how it is working .
XML
<script src="Scripts/jquery.js" type="text/javascript"></script>
    <script src="Scripts/jquery.dataTables.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#tblCustomers').dataTable({ "oLanguage": { "sSearch": "Search the Customers:" },
                "iDisplayLength": 5,
                "aaSorting": [[0, "asc"]]
            });
        });
</script>

    <link href="CSS/demo_table.css" rel="stylesheet" type="text/css" />
<div id="id"  >
        <asp:Repeater ID="rptCustomers" runat="server">
            <HeaderTemplate>
                <table id="tblCustomers"  cellpadding="0" cellspacing="0" border="0" class="display">
                    <thead>
                        <tr>
                            <th>
                                ContactName
                            </th>
                            <th>
                                CompanyName
                            </th>
                            <th>
                                ContactTitle
                            </th>
                            <th>
                                City
                            </th>
                            <th>
                                Country
                            </th>
                        </tr>
                    </thead>
                    <tbody>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <%#Eval("ContactName") %>
                    </td>
                    <td>
                        <%#Eval("CompanyName")%>
                    </td>
                    <td>
                        <%#Eval("ContactTitle")%>
                    </td>
                    <td>
                        <%#Eval("City")%>
                    </td>
                    <td>
                        <%#Eval("Country")%>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </tbody> </table>
            </FooterTemplate>
        </asp:Repeater>
    </div>




And In code behind you just have to bind this control

C#
List<customer> Customers = new List<customer>();
       protected void Page_Load(object sender, EventArgs e)
       {
           if (Page.IsPostBack != true)
           {
               FillCustomers();
           }
           rptCustomers.DataSource = Customers;
           rptCustomers.DataBind();
       }</customer></customer>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900