Use Search button on one page and display results in gridview on second page

Hello!

I am wanting to do a search button on website. I have a "Search button" and a textbox where users will enter their information. After they hit the search button, I would like for them to nagviate to the "SearchResults.aspx" page where the results will be displayed in a gridview. I will be ONLY searching on one table called "Requests" where one of the columns is named "Summary"....i just need to search within the summary column basically. How would I go about doing this? Your help is very much appreciated! Thanks :-)


"People will mainly remember you for who you are, not what you were a part of"
0
ahlaj77
4/3/2008 6:48:54 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

10 Replies
1475 Views

Similar Articles

[PageSpeed] 33
Get it on Google Play
Get it on Apple App Store

You can have just one page with your search criteria in a panel and when they enter the search criteria just hide that panel and pass that criteria to your gridview query statement and make your gridview visible. 


Thanks,
Karan

~ Remember To Mark The Post(s) That Helped You As The ANSWER ~
0
karan
4/3/2008 7:41:06 PM

ahlaj77,

Let me say that I am by far the least qualified in giving out advice, but it just so happens that I just completed an app of my own which mirrors yours almost exactly.  Heck, even my page is named the same as yours:  "searchresults.aspx".  I'm not sure what all you need help with, but let me say this for starters.

Of course, you will need to capture the user-entered information and pass it to the second page. Probably use Context.Items for this. That is, unless you prefer doing it all within one page as karan suggested above.  Upon passing to the second page, you will then bind your query to the gridview.  Do all of this in the page-load event.

Hope I'm correct and this helps a little.


"Hey, how come pirates are so cool?"

"They just ARRRGGGHHHH!!!!!"
0
fralo
4/3/2008 8:06:26 PM

karan@dotnet:

You can have just one page with your search criteria in a panel and when they enter the search criteria just hide that panel and pass that criteria to your gridview query statement and make your gridview visible. 

 If I do decide to do this...after I do a search how can I make my search results panel show up at the top of the page in place of my other panel that simply displays all the information (in a gridview) when you first enter the website. :-) Thanks!


"People will mainly remember you for who you are, not what you were a part of"
0
ahlaj77
4/3/2008 8:13:19 PM

 well when you first enter your website in the page load.

SearchPanel.Visible = true.

Gridview.Visible = false;

 and when they click search:

SearchPanel.Visible = false;

Gridview.Visible = true;


Thanks,
Karan

~ Remember To Mark The Post(s) That Helped You As The ANSWER ~
0
karan
4/3/2008 8:15:08 PM

fralo:
Upon passing to the second page, you will then bind your query to the gridview.  Do all of this in the page-load event.

Is this query one that I make in a SQLDataSource on my 2nd (search results) or 1st page (default page)?


"People will mainly remember you for who you are, not what you were a part of"
0
ahlaj77
4/3/2008 8:15:30 PM

Yes, it will be through the SqlDataSource on your 2nd page.


"Hey, how come pirates are so cool?"

"They just ARRRGGGHHHH!!!!!"
0
fralo
4/3/2008 8:30:58 PM

If my search textbox doesn't return any results..how can I make my IF statement that says something like if my gridview is empty..then say "No Results returned"


"People will mainly remember you for who you are, not what you were a part of"
0
ahlaj77
4/3/2008 8:46:20 PM

GridView has

 <EmptyDataTemplate>
                <asp:Label ID="lbl" runat="server" Text = "No Rows Found"/>
  </EmptyDataTemplate>

 


Thanks,
Karan

~ Remember To Mark The Post(s) That Helped You As The ANSWER ~
0
karan
4/3/2008 8:50:03 PM

Awesome! Thank you :-) ........One More thing....How can you make the enter button work ? When i type in my search textbox I hit enter and nothing happens but when I use my mouse to click the search button it works. What can I do in order to use the enter button as well :-) Thank you very much!!!! Big Smile


"People will mainly remember you for who you are, not what you were a part of"
0
ahlaj77
4/3/2008 9:01:55 PM

You should have your search controls inside a panel and then

set the DefaultButton Property of your Panel to your button id which is in your panel.

Example:

 <asp:Panel ID="Panel1" runat="server" DefaultButton="Button1">
         <asp:Button ID="Button1" runat="server" Text="Text" OnClick="Button1_Click"    />
  </asp:Panel>
        


Thanks,
Karan

~ Remember To Mark The Post(s) That Helped You As The ANSWER ~
0
karan
4/3/2008 9:05:03 PM
Reply:

Similar Artilces:

Post from one search box (on master page) to another search page's query and display result.
Hi, I am using the code for a search using index server from this page http://www.codeproject.com/aspnet/search.asp  I want to post to the search from a text box on another page.  E.g. I have a navigationg box at the top of my page, included in all my page which has a search box and a submit button.  I want, when a user types in their search term, for the query to be posted to the search page and the results shown in one motion like google for example.  The search offers a number of different search options such as all words, any words etc. I would be quite happy for it t...

using dropdowns in master page to display results in detail page gridview
I have about 6 pages that run off the same set of dropdowns - BuildingNo, Year, and Month.  I'd like to use Master pages to take the dropdowns out and put them in the master page so that if the user selects the values and hits go, it'll not only bring back the results of the first pages gridview, but if I use a link to go to one of the other detail pages, it'll keep the values they've picked and display data in the gridview accordingly.example:I pick building 1, January, and 2007 and hit go.  The gridview on my customer page(a detail within the master) shows me deta...

using gridview paging, click IE back button display Warning: Page has Expired
Hi guys,  Right now I am using gridview to paging through records, when I clicked the IE 6.0 back button, it shows me the following message: Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. To resubmit your information and view this Web page, click the Refresh button.   does anyone has any idea about this, I really need to get this fixed, I showed my manager the demo of this project...

Postback of one frame in response to click of a image button in another frame in the same page(Note:-Both frames there are 2 different aspx page but in a same page page using 2 frames)
Hi all, I am having a C# coded page with 2 different frames in it.This 2 frames contain each an aspx file.So the functionality am trying is I have image buttons in one frame .So when i click that image button the other frame i have should load with a specified image in it. I tried redirecting it but that happens only in the first frame where the image buttons are.Resulted in showing the 2 frames in the first frame. I am stuck in this for almost a day.Please can anyone help regarding this?. Regards, Joseph look into the Target attribute of the anchor: for example: <a h...

MASTER PAGE SEARCH BUTTON RESULTS PAGE
I am having a problem with working with a Master Page.  1) I have a Master Page with a search box and button... when i go to the default.aspx page, i click the button that will do a postbackurl to the results.aspx page 2) On the results.aspx page, I have a listview that I want to display the results When I try to do the search from the default.aspx page, the page does not bring the data to the results.aspx page.... when i am at the results.aspx page and i try to search again, it works, but that is only if i run it at the results.aspx page Question.... I want to search fro...

Search query returns XML results. How do I get the results back to the page that submitted the query or a new page.
Hello,I have a search page with a text box and button. When I search for a keyword, my page sends parameters to a search appliance that returns XML results. How can I get the results back to my search page or some other page on my site and not the search appliance. I know I need xlst to transform the XML results but, how do I get the results back on my site instead of the appliance on by just entering a keyword and clicking on the search button. Thanks for any help! I'm assuming that you are doing a direct form based post to the search appliance which is a service taking a keyword and retu...

inserting record present in one gridview in one page into gridview in other page
hi,i have two .aspx pages.one page(watch.aspx) have gridview with fields  given below.the fourth column is a hyperlink column                                                        watch.aspx                      ...

Web page opens second web page, how does first page know when the second one closes?
I have an app written in ASP.NET where one of the web pages opens up a web page in a second window.  When this second web page closes, the first web page needs to update its data.  How do you do this? You can have the child window call a parent method when the user clicks a link to close it. Otherwise, you'd have to set up polling to check for the existence of the child, and refresh if it doesn't exist. Please Mark As Answer posts that helped you."If we learn from our mistakes, I should be brilliant by now." Thanks, this gives me part of the answer...

How to pass a value from one page and display it on the second page control
Hi, I have 2 pages in asp.net. On The first page, I have a name  field and a submit button,once users type their email address and hit the submit button, they should get directed to the second page and a form will be displayed. This form has a name field and it should retrieve and display the same email entered in the first page. So I want to pass the name value from the first page and display it in a field on the second page.How can I achieve this ?    Page 1: -------------------------------------------------------------------------------------<Script Runat="Server...

Want to display a new page using a button of another page
Hi Everyone, I am Sabareeswaren doing an in-house project. i need to know that when i click the button in (WebForm1.aspx.cs) page, Another page say (WebForm2.aspx.cs) should appear in a seperate window. i used "Response.Redirect()" but it appears in the same page itself. please do help me!!!! Thnaks in Advance!!!! Yours Truly, Sabareeswaren. you'll have to pass the call to the clientside events and fire a window.open() or use a target= in a link, again from the client though. The server code cant do what you are asking. Here is a example of doing it using inline code.  The ex...

get data from Gridview in one page to textboxes in another page.
 Hi here iam having Gridview in one page .it is binded to some data.I used querystring to transfer data from Gridview to Textboxes in next page.now my question is i want to edit the textboxes and make changes reflect in database.i edited the textboxes by just deleting the value in Textbox and entering new value.but The changes i made to textboxes are not reflected at runtime.When i debug the codeThe values in TextBox are previous values. The changed values are not reflected.because of that iam not able to update the database.Is there property for textbox to take place the changes i made...

Getting page to stay on current tab when using Gridview paging
I have 3 tabs. On one of my tabs there is a gridview with paging. When the user clicks the "next" or "back" button it does the paging but returns me back to the first tab on the page. Is there a way to set it so that when they do paging it stays on the current tab? Hi, Did you have any code to initialize the selectedindex of tabcontainer to 0 when each postback? The simplest approach is you can create an UpdatePanel into tab pane and put GridView into this UpdatePanel. When you do paging, the tab selectedindex will not be changed and it will update the content of Upd...

How to get the value from one page to another page when i use response.redirect
I have two webforms, webform1 and webform2i am doing the response.redirect on webform1 to get onto webform2.I am doing the following:response.redirect("webform2.aspx?ID=23")Now on webform2.aspx i only have Javascript functions.How can i get the value of my response.querystring("ID") into the javascript function.I am calling this javascript function of forms onload.I have the functions on the html window only not using the vb.net code behind.Please i have real difficulty. Help me.Thank you very much for the information. Hi,Try below code in your webform2.aspx. Private Sub Page_Loa...

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

Web resources about - Use Search button on one page and display results in gridview on second page - asp.net.getting-started

GridView SelectedItem Binding Gotcha in WinRT
Last night when I was doing some WinRT hacking I was trying to setup databinding to the selected item in the GridView control and I ran into ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Advanced Search Gridview Latest News Releases All ...

CNW Group
... Services Beyond the Wire About CNW my CNW CNW Access CNW Directories Financials Webcasts Events my CNW All News Releases Advanced Search Gridview ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Add a Filter Gridview Latest News Releases All Today ...

New CmdLets of Powershell 2.0
New CmdLets of Powershell 2.0

Price Drop: Softbox
... objects- create product reflection- changing the background with something more interestingUse it as:- softbox- honeycomb softbox- gridview ...

Profile.aspx: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 25 Oct 2012

DotNetKicks.com - Upcoming stories
DotNetKicks.com is a community based news site edited by our members. It specialises in .NET development techniques, technologies and tools including ...

View Features - ExtendASP
Call 847-681-9827 or Request a Demo View Features Testimonials Pricing About Us Coming Soon ExtendASP exposes every feature, more than any other ...

Resources last updated: 1/15/2016 6:06:00 PM