Filtering/Search control for Gridview

Hi All,

 can anybody suggest me some ready-made control (Free) or simple way to build one for searching/filtering in gridview. For example, I have 100's products rows in Gridview from database, i want to create a functionality where user can click on search buttons like (A, B, C,D,,,,,) and based on Alphabet, the Gridview filter the rows only.

Thanks,

 

0
fahimataspnetforums
2/27/2008 1:40:02 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies
805 Views

Similar Articles

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

Here's one example for you:

ASPX 

<%@ page autoeventwireup="true" codefile="FilterWithAlphabetLinkButtons.aspx.cs"
	inherits="GridView_FilterWithAlphabetLinkButtons" language="C#" masterpagefile="~/MasterPages/Default.master"
	title="GridView: Filter With Alphabet LinkButtons" %>

<asp:content id="Content1" runat="Server" contentplaceholderid="ContentPlaceHolder1">
	<asp:linkbutton id="btnAll" runat="server" text="ALL" onclick="btnAll_Click" />
	<asp:repeater id="rptLetters" runat="server" datasourceid="sdsLetters">
		<headertemplate>
			 | 
		</headertemplate>
		<itemtemplate>
			<asp:linkbutton id="btnLetter" runat="server" onclick="btnLetter_Click" text='<%#Eval("Letter")%>' />
		</itemtemplate>
		<separatortemplate>
			 | 
		</separatortemplate>
	</asp:repeater>
	<asp:sqldatasource id="sdsLetters" runat="server" connectionstring="<%$ ConnectionStrings:NorthwindConnectionString %>"
		selectcommand="SELECT DISTINCT LEFT(ProductName, 1) AS [Letter] FROM [Products]">
	</asp:sqldatasource>
	<asp:gridview id="gvProducts" runat="server" datakeynames="ProductID" datasourceid="sdsProducts"
		style="margin-top: 12px;">
	</asp:gridview>
	<asp:sqldatasource id="sdsProducts" runat="server" connectionstring="<%$ ConnectionStrings:NorthwindConnectionString %>"
		selectcommand="SELECT ProductID, ProductName FROM [Products] ORDER BY [ProductName]">
	</asp:sqldatasource>
</asp:content>

CODE-BEHIND 

using System;
using System.Web.UI.WebControls;

public partial class GridView_FilterWithAlphabetLinkButtons : System.Web.UI.Page
{
 	protected void btnAll_Click(object sender, EventArgs e)
	{
		gvProducts.DataBind();
	}

	protected void btnLetter_Click(object sender, EventArgs e)
	{
		LinkButton btnLetter = sender as LinkButton;

		if (btnLetter == null) { return; }

		sdsProducts.SelectCommand = String.Format(
			"SELECT ProductID, ProductName FROM [Products] WHERE ([ProductName] LIKE '{0}%') ORDER BY [ProductName]",
			btnLetter.Text);
	}
}

Thanks, Ed

Microsoft MVP - ASP/ASP.NET

0
ecbruck
2/27/2008 1:55:44 PM

MILLION DOLLAR THANKS.

any idea on how to keep the UI consistent in FireFox browser, some of my controls and fonts messed up in FireFox browser but works fine in IE

Any idea how to catch the number of hits to website and storing the number in sql server database through some webservice call in .net or so, for statistical purposes.

For example, number of downloads from website for Trial version of product,,

 Thanks,

0
fahimataspnetforums
2/27/2008 3:47:59 PM

I'm not a front-end developer so I really can't help you on the FireFox issue. As far as your second issue goes, post a new question to the forum as I'm sure someone will have a good suggestion for you.


Thanks, Ed

Microsoft MVP - ASP/ASP.NET

0
ecbruck
2/27/2008 3:50:54 PM
Reply:

Similar Artilces:

gridview control in another gridview control
Hi ia have a questioni have a gridview control which contains button in one colum.now my question is i need another gridview to be placed in the  first gidviewso that when i click on the button the second gridview will populate the data.now my question is how to place second gridview in first gridview.or is there any approach like first grid itself acting as parent and child.please help me  Hi sirikalavalapalli:                I think nested gridview will help you. Check this link and it will show you how...

Getting the control id of a control inside gridview control
 uhmm.. a little bit confusing regarding my subject because i dont know how to say it...by the way my problem is how can i get the id of a control (e.g. textbox) inside the gridview... and the textbox is in the templatefield... is there any way i can get its id??  hoping i could get a reply as soon as possible... Regards,MhaeyPlease remember to click “Mark as Answer” on the post that helps you.. =) What do you want's to do by getting the id of the Text box? Do you want's to find particular Textbox with certain id ? Kamran ShahidSr. Software Engineer(MCP,MCAD.net,MC...

Help Req: !!! :- On Disabling Controls Present inside a Gridview control
Hi All, We have A requirement Where we have disable controls inside a grid.These controls can be textbox, DropDownlist (in TemplateField), ComandField present inside the grid.We have to call a generic method for doing the same .(since it can be done for multiple grid.) PFB the code snippet we use. Which disables all the controls inside the page.The bolded part of the code is used to loop inside a grid view.(Not Working.)Is this ideal way to deal with the requirement.Or can someone suggest be a better way.        public void DisableMe(Page p1, st...

Gridview control embedded in another gridview control
I am writing an ambulance crew scheduling application on the web and I need some help completing the last part.  I have an access database that has three tables: user table, shift table (describing the shifts available), and a schedule table (that stores shift by shift_id and user by user_id).  I have a gridview control that will display the available shifts but I cannot get the embedded gridview control that will display the user that is signed up for each shift to display because I cannot figure out how to use the OnRowDataBound method.  I need a simple VB example of how to...

Data presentation control in another Data presentation control
 Hello,I want to make a menu with datalist or gridview control.Basically,the menu will be like this,Categories     Sub Categories.For example, for COMPUTING category there will be NOTEBOOKS DESKTOPS etc.There will be a image for CATEGORIES and linkbuttons with Subcategories.If I put a datalist inside a datalist and a link button inside the second datalist visually it satisfies my need.However,CommandArguments come from database to linkbutton.Andwhen one of these command buttons is cliked it must go to proper page.I dont know how to wrie an event_handler ,specifically, for...

There is a Gridview Control in the tmplate field of another GridView Control.
    For instance,a gridview displays the information of the  students in a class.A table is recording the information except their mark.There is another table recording the mark of the students whose foreign key is the primary key of the previous table.   string strSQLconnection=".................."; SqlConnection sqlCononection=new SqlConnection(strSQLconnection); SqlCommand sqlCommand=new SqlCommand("select * from stuendent where classID=1",sqlConnection); SqlConnection.Open(); SqlDataReader reader=sqlCommand.ExecuteReader(); GridVie...

using controlS to control a gridview
This question is probably posted but i did not bother to look at 10,000+ posts so i am sorry. I've seen the tutorial where he builds a dataset and uses a gridview and controls the gridview with the drop down list box. What i am trying to do is to control the gridview with 2 drop down list boxes. First select the Country you life in and then the State. I've looked at the grid view properties but couldn't find where i can add another parameter. Is it possible to control a grid view (or any form of displaying the information) with more than 1 controller? Thank You.  ...

SqlDataSource Control and Gridview control
Hi, I'm new to web development and learning about these controls.  The books teach you to bind the gridview control to an sqldatasource to perform delete,update,insert functions as well as to list the records in a table.  Is this standard practice for real world applications?  Or is there another way that should be used to display/manage table data in the gridview control? Thanks. Tulsi Using a sqldatasource is the best way I know of for binding data to a gridview.  (I'm pretty new to web development too, so maybe someone else can chime in if they know someth...

validation controls in gridview control
hi, I m using the grid view to add,edit,update,delete the data table. Everything is fine.In the footertemplate i get the values through text boxes and drop down lists.i took place sm validation controls to validate these controls.the problem arises here.if i want to update the record after i click the edit button, it validate the page n dont allow me to update the record.I want to validate the particular controls only. i checked if any causes validation property for update button.there is nothing like that. pls help me.. thanks in advance gowri  regards,gowripillaimark as answer if...

Precise Control over GridView controls?
Hi.When you create a GridView in visual studios and bind it to, say, an SqlDataSource, it automatically creates fields and templates according to the types retrieved from the data source. (ie, it creates a Label for number/string columns, checkboxField for booleans, etc). My question: How do I control precisely what WebControls/Fields are used for each column?thanks,Tombow Hi Tombow Using TemplateFields you can control that explicitly.  See the Data Tutorial #12 at http://www.asp.net/learn/dataaccess/default.aspx?tabid=63 for more details. Hope that helps. AaronDon't...

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...

using javascript getting value from textbox when edit button is clicked and both controls are present in gridview control
Hi All using javascript I want to get value  from textbox when edit button is clicked and both controls that is texbox and button are present in gridview control .Alok Hi aloksinha83, Please see this post: http://forums.asp.net/t/1069245.aspx Thanks,Qin Dian TangMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

How do I control one control from another control?
I have a page page1.aspx which is within a master page. On page I have a table with two cells. Within each cell I have placed two controls (ascx) that I have developed. Now I'd like to be able to get these two controls to interact. One needs to update the other. One has some search criteria that the other one needs to update its gridview. One needs to make the other visible/not visible at certain times. Out of the box neither control can see each other at all. Is there a good article or someplace I can find some information on how to do this?  AllAboutFocus.com. Information Technolo...

Custom Control within a Control Control
I am developing a custom controls that will render headers for different web sites. Within these controls, I want to place another custom control that will change the language. I created the language control and had it implement IPostBackDataHandler. This control works fine if I drag it on a new web form, but if I tell a header custom control to render it problems occur. The Language Selector custom control does not have a Page member anymore and the event handlers do not work. Does anyone have any experience with doing something similiar? Anyone have any suggestions? Thanks, ...

Web resources about - Filtering/Search control for Gridview - asp.net.presentation-controls

Bayesian spam filtering - Wikipedia, the free encyclopedia
/ ˈ b eɪ z i ə n / BAY -zee-ən ; after Rev. Thomas Bayes ) is a statistical technique of e-mail filtering . It makes use of a naive Bayes classifier ...

Facebook Adds Filtering To Messages, Tests Paid Service
Facebook released an update to its messaging system on Thursday , adding a filtering system and introducing a paid service for U.S. users who ...

Facebook to test option for paid messages between users, announces new filtering controls
... users to pay to send direct messages to another user’s inbox rather than their “other” folder. The social network is also releasing new filtering ...

Filtering mentions - Twitter Blogs
As part of our product development process, we regularly reach out to our partners to better understand what would improve the Twitter experience. ...

ibisMail Free - Filtering Mail on the App Store on iTunes
Get ibisMail Free - Filtering Mail on the App Store. See screenshots and ratings, and read customer reviews.

Google AdSense Category Filtering - Flickr - Photo Sharing!
Details at searchengineland.com/google-adsense-testing-category-filt...

Australia's piracy web filtering - an exercise in futility
Even school children will laugh at the token gesture of blocking The Pirate Bay.

Internet Filtering Scheme's Demise Welcomed
Opponents of Stephen Conroy's mandatory internet filtering scheme are lining up to applaud its demise.

Yandex launches public DNS service with malicious URL filtering - Internet-based applications and services ...
Russian Web search firm Yandex launched a public DNS (Domain Name System) resolution service on Thursday that leverages the company's existing ...

The Filter Is Dead: Australian Government Dumps Controversial Filtering Project [Updated]
Almost three years ago now, Senator Stephen Conroy stepped up to the plate to deliver a bold new vision. A vision of a filtered, “safer” i... ...

Resources last updated: 12/24/2015 3:50:50 AM