473,387 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Use jQuery Autocomplete with C#

294 256MB
Hi all. I am NOT good at writing .NET code, however I have a text box I am using for a search box. I found a great tutorial on it for vb.net, but I can't find out how to get that to c# (I tried a converter).

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Exercise2.WebForm1" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7.     <title></title>
  8. </head>
  9. <link href="Scripts/themes/smoothness/jquery.ui.all.css" rel="stylesheet" type="text/css" />
  10. <body>
  11.        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">
  12.         </asp:ScriptManager>
  13.     <form id="form1" runat="server">
  14.     <div>
  15.  
  16.         <br />
  17.         <br />
  18.         &nbsp;<asp:LoginView ID="LoginView1" runat="server">
  19.             <AnonymousTemplate>
  20.               <strong>  You are not logged in. Please click the login link.</strong>
  21.             </AnonymousTemplate>
  22.             <LoggedInTemplate>
  23.                 <strong> Welcome, </strong><asp:LoginName ID="LoginName1" runat="server" /> </strong>
  24.             </LoggedInTemplate>
  25.         </asp:LoginView>
  26.         <asp:LoginStatus ID="LoginStatus1" runat="server" />
  27.         <br />
  28.         <br />
  29.         <br />
  30. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  31.         <asp:TextBox ID="SearchBox" runat="server" ClientIDMode=Static Width="682px"></asp:TextBox>
  32.         <asp:Button ID="SearchBtn" runat="server" Text="Search Course" />
  33.         <script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script>
  34.         <script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script>
  35.         <script src="Scripts/ui/1.9.1/jquery-ui.js" type="text/javascript"></script>
  36.         <br />
  37.         <br />
  38.     </div>
  39.     <p>
  40.         &nbsp;</p>
  41.     <p>
  42.         <br />
  43.     </p>
  44.     <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
  45.         DataKeyNames="ID" DataSourceID="SqlDataSource1" 
  46.         EmptyDataText="There are no data records to display.">
  47.         <Columns>
  48.             <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
  49.                 SortExpression="ID" />
  50.             <asp:CheckBoxField DataField="txtBook" HeaderText="txtBook" 
  51.                 SortExpression="txtBook" />
  52.             <asp:BoundField DataField="numQuiz" HeaderText="numQuiz" 
  53.                 SortExpression="numQuiz" />
  54.             <asp:BoundField DataField="courseDesc" HeaderText="courseDesc" 
  55.                 SortExpression="courseDesc" />
  56.             <asp:CheckBoxField DataField="courseReq" HeaderText="courseReq" 
  57.                 SortExpression="courseReq" />
  58.             <asp:BoundField DataField="courseRating" HeaderText="courseRating" 
  59.                 SortExpression="courseRating" />
  60.             <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
  61.             <asp:BoundField DataField="course_Num" HeaderText="course_Num" 
  62.                 SortExpression="course_Num" />
  63.             <asp:CheckBoxField DataField="Attendence" HeaderText="Attendence" 
  64.                 SortExpression="Attendence" />
  65.             <asp:BoundField DataField="Grade" HeaderText="Grade" SortExpression="Grade" />
  66.         </Columns>
  67.     </asp:GridView>
  68.     <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
  69.         ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString1 %>" 
  70.         DeleteCommand="DELETE FROM [Review_tbl] WHERE [ID] = @ID" 
  71.         InsertCommand="INSERT INTO [Review_tbl] ([txtBook], [numQuiz], [courseDesc], [courseReq], [courseRating], [Date], [course_Num], [Attendence], [Grade]) VALUES (@txtBook, @numQuiz, @courseDesc, @courseReq, @courseRating, @Date, @course_Num, @Attendence, @Grade)" 
  72.         ProviderName="<%$ ConnectionStrings:ASPNETDBConnectionString1.ProviderName %>" 
  73.         SelectCommand="SELECT [ID], [txtBook], [numQuiz], [courseDesc], [courseReq], [courseRating], [Date], [course_Num], [Attendence], [Grade] FROM [Review_tbl]" 
  74.         UpdateCommand="UPDATE [Review_tbl] SET [txtBook] = @txtBook, [numQuiz] = @numQuiz, [courseDesc] = @courseDesc, [courseReq] = @courseReq, [courseRating] = @courseRating, [Date] = @Date, [course_Num] = @course_Num, [Attendence] = @Attendence, [Grade] = @Grade WHERE [ID] = @ID">
  75.         <DeleteParameters>
  76.             <asp:Parameter Name="ID" Type="Int32" />
  77.         </DeleteParameters>
  78.         <InsertParameters>
  79.             <asp:Parameter Name="txtBook" Type="Boolean" />
  80.             <asp:Parameter Name="numQuiz" Type="Int32" />
  81.             <asp:Parameter Name="courseDesc" Type="String" />
  82.             <asp:Parameter Name="courseReq" Type="Boolean" />
  83.             <asp:Parameter Name="courseRating" Type="Double" />
  84.             <asp:Parameter DbType="Date" Name="Date" />
  85.             <asp:Parameter Name="course_Num" Type="String" />
  86.             <asp:Parameter Name="Attendence" Type="Boolean" />
  87.             <asp:Parameter Name="Grade" Type="String" />
  88.         </InsertParameters>
  89.         <UpdateParameters>
  90.             <asp:Parameter Name="txtBook" Type="Boolean" />
  91.             <asp:Parameter Name="numQuiz" Type="Int32" />
  92.             <asp:Parameter Name="courseDesc" Type="String" />
  93.             <asp:Parameter Name="courseReq" Type="Boolean" />
  94.             <asp:Parameter Name="courseRating" Type="Double" />
  95.             <asp:Parameter DbType="Date" Name="Date" />
  96.             <asp:Parameter Name="course_Num" Type="String" />
  97.             <asp:Parameter Name="Attendence" Type="Boolean" />
  98.             <asp:Parameter Name="Grade" Type="String" />
  99.             <asp:Parameter Name="ID" Type="Int32" />
  100.         </UpdateParameters>
  101.     </asp:SqlDataSource>
  102.     </form>
  103. </body>
  104. </html>
  105.  
  106.  
  107.  
Can someone tell me what I'm doing wrong?
I am clueless. If you need any other information from me, please let me know!
Oct 31 '13 #1
2 2382
Frinavale
9,735 Expert Mod 8TB
I haven't used this myself but probably will be using it in the near future.

Did you see the documentation for the jQuery Autocomplete Widget?



I just glanced over it and you can apply the widget to elements with a specified css class. You haven't done so on your search text box.

Also there are two ways you can supply the source to the auto complete widget: an array (JavaScript array) of strings or a function.

Which do you plan on using?

-Frinny
Oct 31 '13 #2
mcupito
294 256MB
I plan on using a field in the database I am connecting to.

Does anyone have any suggestions?
Nov 5 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: bytesFTW99 | last post by:
i have this, $(function() { $('#input').autocomplete('test.php', {json: true}); }); that bring back values from the database here is my php section
2
pradeepjain
by: pradeepjain | last post by:
http://www.electrictoolbox.com/jquery-count-words-textarea-input/ hi guys i want to build a autocomplete feature in a textarea . so i thought of like when ever the word count increases call the...
0
by: BaseballGraphs | last post by:
Hello, I am trying to format the output of my data with the autocomplete function from jQuery. So far, I've been able to build the entire process, however, I want to limit the information I show...
0
by: BaseballGraphs | last post by:
Hello, I am making use of jQuery's .autocomplete plugin, and I would appreciate some assistance formating the results that show up in the dropdown menu that populates when text is written into the...
0
by: C Sharper | last post by:
Setup: I have a RadioButtonList with two listitems (One Street, the other Schools). These define what type of search I want. I textbox with associated autocomplete. First you select which search...
2
by: Vivekneo | last post by:
Hi, I have a series of textbox wired up with jQuery Autocomplete feature, there are 12 textbox in total. is thr any way to avoid repetitive code, Any help, i will be very thankful. ...
0
by: rhtdmrai | last post by:
I want to apply autocomplete in gridview (in asp.net3.5 with C#) using jquery and this gridview is within the ajax update panel <asp:UpdatePanel ID="UpdatePanel1" runat="server"> ...
0
by: ravishankarsm | last post by:
I have used jquery-1.8.3.js package for appending a table to body. It works good in Mozilla Firefox and Google Chrome >> But Not in IE 6.0 and above >> API used is body.append({table content})....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.