Forms Data Controls :: Build Page With Advanced Search Option
Mar 29, 2010
I am tring to build a page with advanced search options. Here is my code am I on the right path. What I wnat this to do is if you put something in any one of the textboxes it will filter by that column.
<%@ Page language="C#" masterpagefile="MainContent.master" title="Electrical Storage" EnableEventValidation="false" %>
<asp:Content id="Content1" runat="server" contentplaceholderid="Content">
<div id="Rightside">
<h2>Search Electrical Storage
</h2>
<li><a href="EStorageResultsAll.aspx">View All Files</a></li>
<li>Specify Projects to View</li>
<form>
<table style="width: 500px">
<tr><td></td>
<td>Company ID</td>
<td><asp:TextBox runat="server" id="CoID" Width="200px"></asp:TextBox></td>
</tr>
<tr><td></td>
<td>Project Class</td>
<td><asp:TextBox runat="server" id="ProjClass" Width="200px"></asp:TextBox></td>
</tr>
<tr><td></td>
<td>Project</td>
<td><asp:TextBox runat="server" id="Proj" Width="200px"></asp:TextBox></td>
</tr>
<tr><td></td>
<td>File Name</td>
<td><asp:TextBox runat="server" id="FileName" Width="200px"></asp:TextBox></td>
</tr>
<tr><td></td>
<td>File Number</td>
<td><asp:TextBox runat="server" id="FileNumber" Width="200px"></asp:TextBox></td>
</tr>
<tr><td></td>
<td>File Additional Info</td>
<td><asp:TextBox runat="server" id="FileAdd" Width="200px"></asp:TextBox></td>
</tr>
<tr><td></td>
<td>Box Number</td>
<td><asp:TextBox runat="server" id="BoxNumber" Width="200px"></asp:TextBox></td>
</tr>
<tr><td></td>
<td><asp:Button runat="server" Text="Search" id="Button1"></asp:Button></td>
<td></td>
</tr>
</table>
<hr />
<asp:GridView id="GridView1" runat="server" AutoGenerateColumns="False" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" DataSourceID="AccessDataSource1" ForeColor="Black" Width="820px" AllowSorting="True">
<RowStyle BackColor="White" />
<Columns>
<asp:boundfield DataField="CoID" HeaderText="Co ID" SortExpression="CoID">
</asp:boundfield>
<asp:boundfield DataField="ProjClass" HeaderText="Project Class" SortExpression="ProjClass">
</asp:boundfield>
<asp:boundfield DataField="Project" HeaderText="Project" SortExpression="Project">
</asp:boundfield>
<asp:boundfield DataField="FileName" HeaderText="File Name" SortExpression="FileName">
</asp:boundfield>
<asp:boundfield DataField="FileAddInfo" HeaderText="File Add Info" SortExpression="FileAddInfo">
</asp:boundfield>
<asp:boundfield DataField="FileNumber" HeaderText="File Number" SortExpression="FileNumber">
</asp:boundfield>
<asp:boundfield DataField="BoxNumber" HeaderText="Box Number" SortExpression="BoxNumber">
</asp:boundfield>
<asp:boundfield DataField="Location" HeaderText="Location" SortExpression="Location">
</asp:boundfield>
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000066" Font-Bold="True" ForeColor="White" />
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="\Elec1DATABASEStorageElectricalFilesBook.mdb" SelectCommand="SELECT [CoID], [ProjClass], [Project], [FileName], [FileAddInfo],
[FileNumber], [BoxNumber], [Location] FROM [FilesWithLocation] WHERE (([CoID] LIKE '%' + ? + '%') OR ([ProjClass] LIKE '%' + ? + '%') OR ([Project] LIKE '%' + ? + '%') OR ([FileName] LIKE '%' + ? + '%') OR ([FileAddInfo] LIKE '%' + ? + '%') OR ([FileNumber]
LIKE '%' + ? + '%') OR ([BoxNumber] LIKE '%' + ? + '%'))">
<SelectParameters>
<asp:controlparameter ControlID="CoID" Name="CoID" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="ProjClass" Name="ProjClass" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="Proj" Name="Project" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="FileName" Name="FileName" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="FileAdd" Name="FileAddInfo" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="FileNumber" Name="FileNumber" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="BoxNumber" Name="BoxNumber" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
</form>
</div>
</asp:Content>
<asp:Content id="Content2" runat="server" contentplaceholderid="head">
<style type="text/css">
</style>
</asp:Content>
View 2 Replies
Similar Messages:
Feb 16, 2010
I want to be able to make a query from three dropdownlists but not all three have to be selected to create results. This is what I have so far :
sub getdata (src as object, e as eventargs)
dim strsql as string
dim myconnection as oledbconnection
dim mycommand as oledbcommand
myconnection = new oledbconnection(ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_csrdb"))
strsql ="SELECT tbl_case.Case_id, tbl_case.Title, tbl_case.Description, Tbl_Country.Country_Name, tbl_principle.Principle_Name," _
& "tbl_keyword.Keyword FROM tbl_keyword INNER JOIN ((tbl_principle INNER JOIN (Tbl_Country INNER JOIN tbl_case ON Tbl_Country.Country_Id
tbl_case.country) ON tbl_principle.Principle_ID = tbl_case.Principle) INNER JOIN tbl_Usedkeywords ON tbl_case.Case_id
= tbl_Usedkeywords.case) ON tbl_keyword.Keyword_id = tbl_Usedkeywords.keyword " _
& "WHERE "
if DLPrinciple.selectedindex=0 then
strsql = strsql & "((tbl_principle.Principle_Name) like '%')"
else
if DLCountry.Selectedindex=0 then
strsql = strsql & "((tbl_country.country_Name) like '%')"
else
if DLKeyword.selectedindex=0 then
strsql = strsql & "((tbl_keyword.Keyword) like '%')"
else
strsql = strsql & "((tbl_principle.principle_Name) = '" & session("infoprinciple") & "')" + "((tbl_country.country_Name) = '" & session("infoland") & "')" + "((tbl_keyword.keyword) = '" & session("infokeyword") & "')"
end if
end if
end if
This is working perfectly with only one dropdownlist but I can not figure out how to make it work with several.
View 14 Replies
Feb 22, 2011
I have been asked to build an ASP.Net website that has a custom search, when the page is loaded it displays a gridview with a list of data, then when a button is pressed it takes the value from the text box and runs a stored procedure using the value, the gridview then databinds successfully displaying the new data. But the select button does not take the rows data it takes the data from the row corresponding to the data when the page is loaded, not from the search button.
The code for the search is below.
[Code]....
View 3 Replies
Oct 7, 2012
it it possible to add search option a gridview in a web with asp.net and code in vb
View 1 Replies
Sep 30, 2012
I have seen in so many sites on the home page there is a search option and after searching any word of the website it displays and in w3schools it navates to goolge with his reference.
How to write a code for the same and which control we should use.
View 1 Replies
Nov 21, 2010
I am wondering if there are any good articles you could point me to that would present the implementation details or options for delivering advanced search capabilities. Like what we see at [url] and similar Web sites offering vast numbers of products to be searched. The search process for these starts with a simple "Search" text box - usually with auto-suggest. Then the user can drill down and narrow the search by [for example] price, manufacture, size, capacity, and other relevant attributes of the product being searched.
When I navigate such sites and search for products, drilling down into the various categories, it's easy to think that there is some complex engine behind the scenes that generates dynamic SQL to satisfy the various and potentially extensive criterion required to satisfy the search requests.
Or could it be simpler than that? In any case, I understand this question may not have a specific answer; so I'm hoping for some article or reference implementation I could study. Short of that, if any of you have implemented advanced search of a product catalog (presumably searching products stored in a reasonably normalized database; through 3NF or so); any critical implementation considerations would be appreciated. I'm particularly interested in the meta data that may have to be present in the underlying data set in order to satisfy some of the search requests.
View 2 Replies
Aug 14, 2010
I'm working on a asp.net forms web application where I've got advanced search form with grid listing results below. Grid is sortable and pageable. Grid is listing products.
I've got two requirements :
1) make the url remember the advanced search form state so search results page can be bookmarked etc.
2) on the product details page there is a back button that should take the user to the advanced search page with the same settings in the form and same grid state.
I have implemented a workaround to above two problems but I don't think my solution is very clean and I'd like to hear better ideas. My workaround is as follows :
1) I iterate through form fields and I put values into the querystring after the hash. So when the page is loaded it gets the values from url if available.
2) when user clicks a link to product details page from the grid I use javascript to create a cookie with url to advanced search page so when rendering the product details page I know the url for the back button.
View 1 Replies
May 7, 2015
If in one form upload image form we enter ID in textbox againts ID label and upload an image file using fileuploadcontrol when we click on upload button image save in DB and in next form view image when we enter ID in textbox againts label enter ID. Images show in GRIDVIEW having columns (ID,images) ...
View 1 Replies
Apr 19, 2010
how to Add Search Control for Detailsview for search page... simple solution required.?
and is it possible to give field names to each page numbering?
View 3 Replies
Feb 1, 2011
I need to build a search page and a results page for an MVC3 app.
View 2 Replies
Dec 5, 2010
I want to know how can I build a simple search engine which search from specific websites, for example it should search codeplex and msdn only and show the result on my page?
View 1 Replies
Mar 30, 2010
I am attempting to create a list of top ? results of a specified column(s) of a specified table on a specified database. Sounds tricky, huh? I am attempting to create a key creator for a raw data table. So far I have a list of all raw column names in the table displaying on a checkboxlist control. On the page there is a checkboxlist control on the left. A drop down menu in the middle and a gridview (hidden until the checkboxlist selects an item) on the far right. Once the user selects an item on the checkboxlist control and also selects an item (or leaves it as default) in the drop down menu (values consist of : 1, 2, 3, 4, 5, ect.) the gridview will appear and display the top (value in the drop down menu) results of the selected column in the checkboxlist control (would be nice to allow the user to select multiple items and have the gridview grow as more columns are selected and shrink as they are deselected). I am having trouble figuring this out. So far I have attempted to write a dynamic sql stored procedure, add parameters to the sqldatasource and change the value at runtime, and now I am reaching out to the ASP.Net community.
[Code]....
View 1 Replies
Sep 8, 2010
I have a gridview with two textboxes (first name & last name) and a linkbutton to search results inside the gridview.
I have made select parameters as well and the search works if i write in both textboxes. However, if I leave one textbox blank, i don't get any results.
[code]...
How can I get results from searching only one textbox?
View 4 Replies
Mar 22, 2010
'm using a gridview with paging and sorting in asp.net (language = VB).The gridview shows all the artists in my database. I've added a searchbox above my gridview, so users can search for certain artists by name.The search option works. If I enter the name: John --> it shows the artists who have the name John.Now for the problem:If the user filtered the gridview (for eample searching for John) and switches to another page of the gridview, the gridview is again filled with all the artists instead of the artists that are named John.
View 12 Replies
Oct 17, 2010
how to create search option for a site.
i want to place option on site that custmor can seach thing on site by writting word or phrases like google.
View 1 Replies
Jan 10, 2014
How to create a page which return ranking of keyword w.r.t it's site.
for e.g if i write www.aspforums.net
and enter keyword asp.net
it should return ranking of this keyword for diff search engines
View 1 Replies
Jun 3, 2010
I've been using a repeater to build a website's site map page by binding to the web.sitemap file. For example, to display 2 levels of links:
[Code]....
So far, everything works well. However, in some cases, I do not want to display certain pages in the site map. I've added a custom attribute to each node (nodisplay= 'true').How can i check for this attibute, and avoid it from being displayed by in the repeater.
View 3 Replies
Feb 10, 2010
I have a page which gives user to generate report based on different filters selected. my thoughts Loop through each filter control (checkbox, multi select list, radiobox list) and build dynamic where conditions and conjunctions for each filter and then run query Get all the data (i think this will causes an overload with all 4-5 tables joined) and then use Linq to filter this data based on user selection Is there a better way to implement this?
View 2 Replies
Mar 26, 2010
In my web application I need to Search a gridview by a Text which entered in a textbox, and in a Button_Click().
I need to search the Text in a particular column only, so I use the gridviewrow property and searched which item template contains the Text. But, it works in the First page index of the GridView not in the Next and others, How can I Enable the Search Up-to the Last page index and the Last row of the GridView.
[Code]....
View 3 Replies
Feb 25, 2011
I will explain this as best I can. When a user types in a search field (ASP Textbox field) and presses enter a list of search results are displayed if there is a match. The search results display in the second half of the page. A video will play in the top half of the page but not until a querystring is passed to the page. The querystring value comes from the list of displayed search results. When a user clicks on results from the search (ASP Hyperlink) the querystring value is passed to the same page he/she is on and a video starts playing. My major problem is when I pass the querystring value I do not want to lose the list of search results. It looks like in ASP.net the page refreshes each time you pass a new value. It's not optional to make the user click the back button to see the orginal search results. I'm assuming it has something to do with maintaining session state but I am no expert. YouTube and many other sites do this similar functionality so I figure it must be possible in ASP.Net.
So basically, I want the image that I searched for to continue to display even as I select them and pass there videoID to the SQLDataSource that is expecting the QueryString. All values are being pulled from a SQL 2008 database. When the QueryString value is passed a video will play based on the value that was passed. Currently I have this working but the problem is when I pass the querystring my displayed search results are gone or disappeared. I was thinking that maybe if I could pass the querystring value and the search results value it would work. It would mean reposting the data again but I guess that's a work-around. So for instance if a user typed 'biceps' in the orginal search some kind of way I would store biceps somewhere and pass it again along with the querystring for the video. It doesn't seem like the most eficient way to do it but if someone on here suggest that's the best way I will also need help with that syntax. I am using ASP.Net 4 and VB instead of C#.
View 1 Replies
Jan 16, 2010
I have two tables: Book and author and they have one to many relation.One book may have more than one authors. Book table has Title column and Author table has AuthorName Column.
I have search page contains two textboxes: Title Textbox and AuthorName textbox to search the record.
When the user type something and hit the search button it display the Title when click the title ; it redirect to detailsPage.aspx Passing value ID.
[Code]....
Then in the Details page there are: Title, authors and other more from these table column.
My problem is:
When the user search and hit the search button, it display the number of matches Title only. I want to display authors related to this title in this page and other are same(when click the title go to detailspage.aspx)
How can I display the related Authors to each title in search display page (Not in details page, I know in details page) ?
If user search "The Letters and life" in the Title textbox and hit enter data should looks like:
1. Author: Payne Paddy, sed ran, der virma and Caroline Barron.
Title: The Letters and Life of Elizabeth Despenser, Lady Zouche (d. 1408) [her letters and will provide a glimpse of her personal
2. Author: ayne manu, edd saan and fer wertu.
View 13 Replies
Nov 26, 2010
how to do a search using a Full Text Search Catalog. I would also like to have the results on the page highlighted?
View 1 Replies
Dec 20, 2010
I'm buidling text search box for a field in a database table. How can I code search all in web form and Stored procedure?
View 6 Replies
Jan 19, 2011
I don't know how to keep in sync the filtered elements of a DataGrid after the user applies a filter. The problem is when she/he tries to edit one filtered elements.... it is not the correct item!
[Code]....
How to update the index for the elements returned by the filter process?
View 2 Replies
Nov 8, 2010
We do have a search page for customers which returns a list of data from a table.
Once we select on an item it should redirect to another page with customerId as a querystring parameter..
Now the problem is we have to save all the customerIds and need to send them to display page..and need to select next one once they done with previous one without going to the search page again..
Example:
if they got 10 customers in the search page then we need to send all 10 ids to display page by starting display of firstone and once they select next button on display page they have to move on to the next cutomer from that list..if they reached the end of list they have to start again from the first...we need to avoid the user going to the search page for each customer every time...
View 4 Replies