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