Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
when i click a button a pop up window should be displayed with a textbox and when i search the textbox the results shoud be displayed in a gridview. Any ideas?

What I have tried:

I need some ideas on how to start.
Posted
Updated 2-Oct-19 23:36pm
Comments
Afzaal Ahmad Zeeshan 3-Oct-19 2:37am    
Desktop or Web based solution?
chandra sekhar 3-Oct-19 4:22am    
web based

1 solution

I'd start getting the search facility working with a textbox on the page rather than in a pop-up. Google how to call ajax methods from javascript and get it so that you can make an ajax call to a url on every keyup event of the textbox, passing the contents of the textbox as the "data" parameter. Next you need to implement a server-side method that does the searching. You haven't even said if this is webforms or MVC, if it's webforms you'll need a WebMethod. If MVC a standard controller action will do. Write one that accepts text as a parameter, make sure the method is called and has the data passed as you type in the box.

Next implement the search such that it returns the results as JSON. How you do the search is up to you, we can't suggest anything as you have provided no information at all.

Next you need to make sure you get the returned JSON from your ajax call in your javascript. Once that is working you need to make a table from that JSON and inject it into the page. Google how to create a table from JSON.

Running your search on every key-up probably isn't the best way of doing things, instead you'll probably want to trigger an delay on key-up that fires after maybe a second. On every keyup cancel the trigger and create a new one, this can be done using setTimeout (google for usage examples), and means that your search code only fires a second after they have stopped typing rather than on every keystroke.

Once that all works you can work to put the textbox in a pop-up rather than having it on the page so google how to make a popup-up with jquery. There are lots of ways of doing this and lots of plug-ins. Given you want to amend the parent page I'd suggest you don't use any pop-up method that involves an iframe. Most pop-up plug-ins come with code that instigates the pop-up from a button click.

That's the order I would do things in, if you get stuck then feel free to ask specific questions about specific problems, but don't expect us to do all of the work for you.
 
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