Click here to Skip to main content
Licence 
First Posted 15 Oct 2007
Views 9,904
Downloads 68
Bookmarked 10 times

Generate Filter String

By | 15 Oct 2007 | Article
Generate Filter String as per user requirment
Screenshot - filter.jpg

Introduction

Here I introduce one filter control base on query

Using the Code

In this code I am create one usercontrol so

1) Register a usercontrol

<%@ Register TagName="Filter" TagName="Filter" TagPrefix="UC" 
    Src="~/filtercontrol/FilterControl.ascx" %>

2) Pass appropriate data

in page load method

you have to pass one two dimension string array

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            string[,] col = new string[2, 2];
            col[0, 0] = "val";
            col[0, 1] = "coltex1";
            col[1, 0] = "val2";
            col[1, 1] = "coltext2";

            filter1._Collumname = col;

        }
    }

3) use function

On button click even use the function for gating filter string and clear the filter criteria

    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = filter1.filterstring();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        filter1.blankfilter();
    }<o:p />

i am apply this user control for filter the record in recordset , view state etc.

you can also change the code for your requirment

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Chirag Patadia



India India

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralSuggestions Pinmemberwout de zeeuw2:46 15 Oct '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 15 Oct 2007
Article Copyright 2007 by Chirag Patadia
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid