SQL Server :: Method To Allow A User To Search In A Specific Field For A Records Containing The Keywords They Enter Into A Textbox?

Aug 19, 2010

What's the best method to allow a user to search in a specific field for a record(s) containing the keywords they enter into a textbox? I am considering using the streamreader to obatin the values from textbox into an array, so I can build dynamic query using the stringbuilder. Is there a cleaner or more efficient method to approach this common search functionality?

View 1 Replies


Similar Messages:

To Create A Search Textbox For Users To Enter A Few Keywords In?

Feb 19, 2010

I want to create a seach textbox for users to enter a few keywords in ,..and then my sql query will display the results......( basically a little search engine for my website)Ok so im thinking of using the Containstable with ranking on how close these keywords are to eachother... so the closer the keywords are to each other... the higher their ranking will be.... but I also want to seach for these keywords in 4 columns in one Datatable how can I do this

View 7 Replies

Webforms - Search Field Enter Button

Feb 10, 2011

I have a web page with 3 search fields on it, each with a different submit button. When using the enter button on the keyboard to submit any of them, an incorrect action is being performed, although with the mouse it's fine. Any ideas why this is happening? The rendered HTML as requested below:

<!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 id="ctl00_ctl00_Head1">
<body id="home">
<form name="aspnetForm" method="post" action="history_lookup.aspx?theme=t2" id="aspnetForm">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE1MzkzOTQxNDBkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYFBSZjdGwwMCRjdGwwMCRNaW5pQ2FydFRleHQxJEltYWdlQnV0dG9uMQUsY3RsMDAkY3RsMDAkVG9wTmF2JFF1aWNrU2VhcmNoMSRJbWFnZUJ1dHRvbjIFLGN0bDAwJGN0bDAwJFRvcE5hdiRRdWlja1NlYXJjaDEkSW1hZ2VCdXR0b24xBShjdGwwMCRjdGwwMCRjcGhSb290JGNwaFN1Yk1hc3RlciRzdWJtaXQxBShjdGwwMCRjdGwwMCRjcGhSb290JGNwaFN1Yk1hc3RlciRzdWJtaXQy4UTdoX+Ej1GFsXGOrI898SMftDA=" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script src="/WebResource.axd?d=gfGwAOwAxcQ9Nlq6l3EJfg2&t=634166396192656250" type="text/javascript"></script>
<div>
<input type="hidden" name="__PREVIOUSPAGE" id="__PREVIOUSPAGE" value="fwZ-2v_x8CYGGr9a8Ce0s6gkE38QmubHNljKJaKxZV41" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWCAKs3Nu8DwLV2a2zBwKK/6PwCQLBpvyBBAKT+aizBgL+qMTTDwLU1/SWCwL+qNiuCArtGFkuC9Zj3X3If1cwPC7PKtcm" />
</div>
<div class="container clearfix" style="left: 0px; top: 0px">
<div class="utilityNav">
<a class="MenuItem" href="/extranet.aspx?theme=t2" title="Account Info">
Account Info
</a>
|
<a class="MenuItem" href="/history_lookup.aspx?theme=t2" title="Order History">
Order History
</a>
|
<a class="MenuItem" href="/_user_logout.aspx" title="Sign Off">
Sign Off
</a>
</div>
<div class="header">
<div class="cart" >
<div id="menu">
<div class="cartimage">
<input type="image" name="ctl00$ctl00$MiniCartText1$ImageButton1" id="ctl00_ctl00_MiniCartText1_ImageButton1" src="images/bg-cart-corner.gif" align="left" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$MiniCartText1$ImageButton1", "", false, "", "cart.aspx", false, false))" style="border-width:0px;" />
</div>
<div class="cartlabel">Checkout Cart:<br />
<a id="ctl00_ctl00_MiniCartText1_lbMiniCart2" class="cartlink" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$MiniCartText1$lbMiniCart2", "", false, "", "cart.aspx?theme=t2", false, true))">View your cart</a>
</div>
<br /><br />
</div>
</div>
</div>
<div class="primaryNav">
<div class="navdropdown">
</div>
<div align="right" class="quicksearch">
<div class="QuickSearch">
<div id="ctl00_ctl00_TopNav_QuickSearch1_quicksearchpanel" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'ctl00_ctl00_TopNav_QuickSearch1_ImageButton1')">
<table cellpadding="0" cellspacing="0" class="QuickSearch">
<tr>
<td class="quicksearch_text">
<span id="ctl00_ctl00_TopNav_QuickSearch1_lblSearch"></span>
</td>
<td >
<input class="QuickSearch" type="text" name="searchstring" size="15" maxlength="30" value="Search" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}" />
</td>
<td class="quicksearch_button">
<input type="image" name="ctl00$ctl00$TopNav$QuickSearch1$ImageButton2" id="ctl00_ctl00_TopNav_QuickSearch1_ImageButton2" src="images/searchbutton.gif" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$TopNav$QuickSearch1$ImageButton2", "", false, "", "/Searchdh.aspx?theme=t2", false, false))" style="border-width:0px;" />
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<td valign="top">
<div class="HistoryLookupPage">
<h1 class="PageHeader">
<span id="ctl00_ctl00_cphRoot_cphSubMaster_PageHeader1_LabelHeader">Order History</span>
</h1>
<p>
Enter the reference number of the order you want to see.
</p>
<p>
Reference number
<input name="ctl00$ctl00$cphRoot$cphSubMaster$CustomerReference" type="text" id="ctl00_ctl00_cphRoot_cphSubMaster_CustomerReference" class="borderTextBox" />
<input type="image" name="ctl00$ctl00$cphRoot$cphSubMaster$submit1" id="ctl00_ctl00_cphRoot_cphSubMaster_submit1" src="images/buttons/findorder-blue.gif" style="border-width:0px;" />
</p>
<br />
<p><b>Or search by PO Number</b></p>
<p>
<input name="ctl00$ctl00$cphRoot$cphSubMaster$CustomerReference2" type="text" id="ctl00_ctl00_cphRoot_cphSubMaster_CustomerReference2" class="borderTextBox" />
<input type="image" name="ctl00$ctl00$cphRoot$cphSubMaster$submit2" id="ctl00_ctl00_cphRoot_cphSubMaster_submit2" src="images/buttons/findorder-blue.gif" style="border-width:0px;" />
</p>
</div>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
and the aspx markup
<%@ Import Namespace="System.Configuration.ConfigurationManager" %>
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="history_lookup.aspx.vb"
EnableViewState="false" Inherits="history_lookup" ValidateRequest="false" CodeFileBaseClass="Main.Page"
MasterPageFile="~/masters/default/main.master" RuntimeMasterPageFile="ThreeColumn.master"
CrumbName="<%$ Resources: Language, LABEL_MENU_HISTORY %>" %>
<%@ Register Src="~/controls/Message.ascx" TagName="Message" TagPrefix="uc1" %>
<%@ Register Src="~/controls/PageHeader.ascx" TagName="PageHeader" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphSubMaster" runat="Server">
<td valign="top">
<div class="HistoryLookupPage">
<uc1:Message ID="Message1" runat="server" />
<uc1:PageHeader ID="PageHeader1" runat="server" Text="<%$ Resources: Language, LABEL_MENU_HISTORY %>"
EnableTheming="true" />
<p>
<asp:Literal ID="Literal1" runat="server" Text="<%$ Resources: Language, LABEL_PLEASE_ENTER_ORDERREF %>"></asp:Literal>
</p>
<p>
<asp:Literal ID="Literal2" runat="server" Text="<%$ Resources: Language, LABEL_HISTORY_LOOKUP %>"></asp:Literal>
<asp:TextBox runat="server" ID="CustomerReference" CssClass="borderTextBox" />
<%-- <asp:Button ID="Button1" runat="server" CssClass="BtnC" Text="<%$ Resources: Language, ACTION_LOOKUP %>" />
--%> <asp:ImageButton ID="submit1" runat="server" imageurl="~/images/buttons/findorder-blue.gif" />
</p>
<% if Not globals.User("Anonymous") then %>
<br />
<p><b>Or search by PO Number</b></p>
<p>
<asp:TextBox runat="server" ID="CustomerReference2" CssClass="borderTextBox" />
<%-- <asp:Button ID="Button2" runat="server" CssClass="BtnC" Text="Find Order" />
--%> <asp:ImageButton ID="submit2" runat="server" imageurl="~/images/buttons/findorder-blue.gif" />
</p>
<% end if %>
</div>
</td>
</tr>
</table>
</asp:Content>

View 1 Replies

JavaScript: Clear Search - Field When Enter With Mouse?

Mar 7, 2011

I have a textfield () in my homepage for a searchstring. Normaly I have a text like "enter here to searach..." in it. Now I will clear the box from the text when a user click into it.

View 4 Replies

Search - Detecting Enter In TextBox No JavaScript

Mar 24, 2010

Basically I have a Search Text Box with a LinkButton Control on which the click event is fired. now what i want is when the user type keywords and press enter the Click event got fired. So No Javascript Only ASP.NET With VB.NET v2.0

View 2 Replies

Forms Data Controls :: After Search Results Is Populated, Click On The Hyperlink To View Specific Records Tied To It.

Feb 10, 2011

currently I am doing a web application such that after user search for all the contracts,the contract id is a hyperlink in which user can click on it to view the results tied to it. There is 2 pages. One is for the search page and after searching results is populated below. The contract id in the grid view is a hyperlink so that when user clicks on it, they will go to another page and view the specific records tied to it. How shld I do this as I am creating this web application in 3-tier formatting.

This is the search.aspx:

[Code]....

This is the next page that will display the results tied to this particular ID:

[Code]....

View 3 Replies

User Controls :: How To Use Enter Key Instead Of Button For Search

May 7, 2015

Instead of clicking button ,How Enter Key Works??

Type Something in TextBox and Press Enter and result appear without Clicking any button , How??

View 1 Replies

Search More Then 2 Keywords In C#.net?

Dec 17, 2010

i want to Search more then 2 item with one TEXTBOX field using with , Eg. item1,item2.

Result should be shown for both in one gridview i am using SP with one Parameter.

View 2 Replies

Search Engine Support Keywords?

Jun 14, 2010

this is naresh.i have some query.in google search engine while typeing any letter based on letter some support keyword is getting.

View 8 Replies

Web Forms :: Search Filter GridView Records Based On TextBox?

Oct 9, 2012

i want to get data from database using text box . when i enter id in text box it should fetch all the record related to that id ?

View 1 Replies

User Controls :: Restrict User To Enter Only English Or Arabic Characters In TextBox

Oct 14, 2012

I want user to enter name in Arabic if the user enter in english it should give Message " Enter Message In Arabic " and same for English if user try to enter in arabic it should give a message "Enter Name in English" ...

View 1 Replies

SQL Server :: Search Word In Column Separated By Enter Key?

Jul 30, 2010

how can i separate words in db column separated by enter key. I am entering data in a multi line textbox directly to db, and i want to search a word in that column. Since the words are seperated by enter key, how can i separate the words to search. If i use like i can't search the exact word is there..

View 2 Replies

SQL Server :: DateTime In SQL Query / Want To Prompt Users To Enter A Specific Date ?

Dec 1, 2010

I'm writing a program that records time-in and time-out and I have a problem when trying to retrieve data for a specific date.In the table, the "timein" and "timeout" fields have format of "smalldatetime". To record the timein, I insert the system time (by using System.DateTime.Now) into the "timein" field.I want two types of searches.

1) Search records between a date range

2) Search records for a specific date

For example, First, I want to search if there are any records between 11/2/2010 and 12/1/2010. I will ask user to input "11/2/2010" as start date and "12/1/2010" as end date. I will use Convert.DateTime() methods to convert these two input before put them
into SQL query like:

"SELECT * FROM timesheet WHERE timein BETWEEN Convert.DateTime(startdate) AND Convert.DateTime(enddate)"

The output results do not include the date 11/2/2010 and 12/1/2010. I get only the dates in between. I know that is the limitation of BETWEEN. I wonder if someone has a way to work around this limitation.

Secondly, I want to prompt users to enter a specific date like (11/2/2010) and search the table for rows match that criteria. I can't get this to work. I have tried "SELECT * from timesheet WHERE timein LIKE '%searchdate%'", "......timein = 'searchdate'" but none works.

(I'm using VS 2010 C# and SQL 2008 for this project)

View 6 Replies

How To Show Keywords And A Search Box Under Site's Google Results

Jan 20, 2010

I saw on the google when search "code project", some keywords and a text field and a button to search that google has generated for "code project" keyword also for "manchester university" in the same way.

How is it possible to show key words and text field/button for our website on google? As it shows for "code project" and "manchester university" etc.

visit google and search "manchester university" u'll see:

StudentNet Job Opportunities
PostGraduate StaffNet
etc..
and
textfield/ and a button

I want this kind of result for my site from Google!!

View 2 Replies

SQL Server :: Want To Read Specific Records From

Oct 7, 2010

i want to read specific records form a table for example(tb)

if the field cosnsist of 100 record and i want to read form 70 to 80 what is the query for this but with out using ID field in the query

View 3 Replies

Forms Data Controls :: Highlight Search Keywords In Gridview?

Jul 12, 2010

I build a serach function just using SelectCommand and SelectParameters, i.e.

<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:mprojectConnectionString %>"
SelectCommand="SELECT * FROM [publication] WHERE ((([character] LIKE '%' + @character + '%') AND ([type] = @type))
OR(([f11623] LIKE '%' + @f11623 + '%') AND ([type] = @type))
OR (([f1character] LIKE '%' + @f1character + '%') AND ([type] = @type))
OR(([nortonoxfordnumber] LIKE '%' + @nortonoxfordnumber + '%') AND ([type] = @type))
OR (([nortonoxfordtext] LIKE '%' + @nortonoxfordtext + '%') AND ([type] = @type)))">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="character" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="TextBox1" Name="f11623" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="TextBox1" Name="f1character"
PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="TextBox1" Name="nortonoxfordnumber"
PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="TextBox1" Name="nortonoxfordtext"
PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="DropDownList1" Name="type"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>

I am also using a dropdown box and a textbox for people to search within a particular area from the dropdown list.

Now, I would like to be able to highlight the keywords in my gridview table. I searched around on the Internet and found a lot of samples, but they are all related to the Gridview <templates>, however, I am using <BoundField> and sqlDataSource.

I just cound not figure out how can I add this highlight function to my current search function?

View 4 Replies

Forms Data Controls :: Search Multiple Words Into Textbox And Populate All Records In Gridview

Aug 24, 2010

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?

View 3 Replies

Data Controls :: Search GridView Records On TextBox KeyPress Using JQuery In Master Page

May 7, 2015

I tried to modify downloaded code from URL... to use with content pages/ master page by placing javascript at master page and put below code at the content page, But the when i type somethng on the text nothing filters. How to filter gridivew using master page.

* I am using VS 2005

* GVPRFInquiry => Gridivew

* PR.PRFInquiry(BadgeNo) => return dataset containing results

* txtSearch  => text box created at the top of gridview.

Below query brings data to the gridivew on page load.

If Not Me.IsPostBack Then
Dim ds As New DataSet
ds = PR.PRFInquiry(BadgeNo)
GVPRFInquiry.DataSource = ds
GVPRFInquiry.DataMember = "DataSet"
GVPRFInquiry.DataBind()
End If

below code create text box inside gridview to filter and calls the javascript.

Protected Sub OnDataBound(ByVal sender As Object, ByVal e As EventArgs)
If (Not Master.Page.ClientScript.IsStartupScriptRegistered("function")) Then
Master.Page.ClientScript.RegisterStartupScript(Me.GetType(), "function", "fucntion();", True)
End If
Dim row As New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal)
For i As Integer = 0 To GVPRFInquiry.Columns.Count - 1

[code]...

View 1 Replies

Forms Data Controls :: Show A Grid View Control That Is Initially Displayed To Allow The User To Enter Multiple Records?

Jan 19, 2010

I want to show a grid view Control that is initially displayed to allow the user to enter multiple records. This grid view will not be tied to a database nor will it need to save the data that is enter into the GridView Control directly to a database.

View 3 Replies

Asp:textbox - How Does User 'enter' To Next Line

Feb 12, 2010

I have a asp:textbox control followed by a button.The textbox is multiple lines, but when users hit 'enter' to go to the next line (trying to do a carriage return), the button 'onclick' event is executed. how do I change that?

View 5 Replies

Data Controls :: Filter Records GridView By Selecting Column Name From DropDownList And Search Term From TextBox

May 22, 2013

need to get selected value from dropdownlist,textbox and bind in grid

View 1 Replies

SQL Server :: Search The Table Name Containing A Specific Data  in A Given Database?

Aug 27, 2010

is there any way to search the table name containing a specific data in a given database.

for example, if i have any data, say "Euro" in hand, and i know any of the table in database contain the given value, however i'm not sure which table. So if i can list out the table anyhow containing the data in hand.

View 5 Replies

TextBox Validation - User Can't Enter In All Caps

Feb 14, 2012

Which Regex do I use so the user can't enter in all caps in the textbox?

I want...

Now is the time

Don't want this...

NOW IS THE TIME

View 1 Replies

Add Search Field And User-friendly Results?

Jan 6, 2011

I want to add a search field and have search results display in a user-friendly format on an employee intranet. Does anyone know what component(s) I can drag over from the toolbox to create these two items?

View 4 Replies

Trying To Let A User Enter The Name Of A Website In A Textbox And Click On A Button?

Feb 22, 2011

I'm trying to let a user enter the name of a website in a textbox and click on a button. When the button has been clicked the website URL should be sent to a method which will use a WebBrowser to navigate to the website and take a screenshot of it. Further it should afterwards grab this screenshot and generate a thumbnail of it.

... And the tricky part

The tricky thing is that according to MSDN the System.Drawing should not be used in neither Windows or ASP.NET services, which leaves me with 2 approaches:

Ignore the MSDN and implement the class which contains the necessary methods.

Create a WCF Service with the necessary methods.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved