Forms Data Controls :: Filters To A Gridview Control Like Filters In Excel Sheet?

May 26, 2010

How to apply filters to a gridview control like filters in excel sheet?

View 2 Replies

Similar Messages:

Forms Data Controls :: Possible To Put Filters On Gridview Which Is Bound To A Datatable

Apr 18, 2010

what it is i have a datagrid bound to a datatable.This datatable fills from a sql table. This datatable will have 2 columns which is 'part' and 'description'.What it is I want to have a couple of chk boxes next to the datagrid which will filter it by column 'part'.The issue is the datagrid will have about 1000 records so i dont want to do a for next loop searching for field part for a certain filter

View 1 Replies

Forms Data Controls :: How To Use Dynamic Query Filters With A Gridview Using A Stored Procedure As A Data Source

Jul 1, 2010

Is it possible to use dynamic query filters with a gridview using a stored procedure as a data source? What I'm thinking of is a search page where there are multiple controls to enter in a search string and a radio button for the AND/OR query filters between the various controls. If not, what would be the best way to allow a user to select an AND / OR with a group of different query controls?

Here is the page I have created thus far using a view and no AND/OR option. I but I can't get it to work with my SP, also listed below:


View 9 Replies

Forms Data Controls :: Programmatically Display DataList (with Row Filters)?

Dec 5, 2010

I have a website developed in C# with Visual Studio 2010. I am using datalist to list the documents for monthly meetings. Each monthly meeting has 6 datalists representing each section of the monthly meeting. I am using row filters to filter the data for the respective month and section. I am using the Membership Provider model and am displaying the documents for the respective user. When a user clicks on the document link the document is marked and displayed as "read". This is all working as it should in my existing code.

However, I would like to be able to display this data programmatically. My oldest data is December 2009. I would like to dipslay this data programmatically based on todays's date and then looping back until December 2009. Today, I update the web form and the code behind on a monthly basis and I know that there is probably a better way to do this. I think this can be done but I am not certain if it can be done with row filters, because amongst other things I do not know how I can dynamically generate the datalist ids so that I can then bind the row filtered data.

Below is a sample of my code for one month of data.


View 1 Replies

Forms Data Controls :: Multiple Dropdown Filters To Sort A Grid View

Jan 4, 2010

wondering if someone can possibly help me out with a gridview. I have data coming into a grid and I know how to filter the data using one dropdown, I'm trying to get a little more advanced now. I'd like to filter using three dropdowns.

This is what I have so far: I don't know how to hook the downlists to the query?

<asp:DropDownList runat="server" id="DropDownList1" Width="90px">
<asp:ListItem Value="item_num">Item #</asp:ListItem>
<asp:ListItem Value="lot_num">Lot #</asp:ListItem>
<asp:ListItem Value="production_code">Production Code
<asp:ListItem Value="batchcode">Batch Code</asp:ListItem>
<asp:ListItem Value="inbound_no">Inbound #</asp:ListItem>
<asp:ListItem Value="recv_date">Received Date</asp:ListItem>
<asp:ListItem Value="location">Location</asp:ListItem>
<asp:ListItem Value="category">Category</asp:ListItem>
<asp:DropDownList runat="server" id="DropDownList2" Width="160px">
<asp:ListItem Value="=">is equal to</asp:ListItem>
<asp:ListItem Value="<=">is less than or equal to
<asp:ListItem Value=">=">is greater than or equal to
<asp:ListItem Value="<>">is not equal to</asp:ListItem>
<asp:ListItem Value="begins with">Begins With</asp:ListItem>
<asp:ListItem Value="Like">Ends With</asp:ListItem>
<asp:TextBox runat="server" id="TextBox1" Width="150px">
<asp:Button runat="server" Text="Go" id="Button8" BackColor="Lime" />
<asp:Button runat="server" Text="Clear Filter" id="Button9" /><br />
<input name="Checkbox1" type="checkbox" /><label id="Label5">
Include Items containing "Zero on Hand" Quantity.<br />
Group by Fields: <input name="Checkbox2" type="checkbox" />
<input name="Checkbox3" type="checkbox" /> Production Code
<input name="Checkbox4" type="checkbox" /> Batch Code</label><label id="Label4"></label><br />
<hr />
<asp:GridView runat="server" id="GridView1" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Font-Size="Small" BorderStyle="None" BackColor="White" GridLines="Vertical" BorderColor="#999999" BorderWidth="1px" CellPadding="3" Font-Underline="False"
AllowSorting="True" AllowPaging="True" PageSize="20">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<asp:boundfield DataField="STATUS" HeaderText="Status" SortExpression="STATUS">
<asp:boundfield DataField="ITEM_NUM" HeaderText="Item #" SortExpression="ITEM_NUM">
<asp:boundfield DataField="LOT_NUM" HeaderText="Lot #" SortExpression="LOT_NUM">
<asp:boundfield DataField="LOT_EXT" HeaderText="Lot Ext" SortExpression="LOT_EXT">
<asp:boundfield DataField="RECV_DATE" HeaderText="Recv Dt" SortExpression="RECV_DATE">
<asp:boundfield DataField="PRODUCTION_CODE" HeaderText="Prod Code" SortExpression="PRODUCTION_CODE">
<asp:boundfield DataField="QTY_ONHAND" DataFormatString="{0:NO}" HeaderText="OnHand" SortExpression="QTY_ONHAND">
<asp:boundfield DataField="QTY_RESERV" HeaderText="Reserv" SortExpression="QTY_RESERV">
<asp:boundfield DataField="QTY_AVAIL" DataFormatString="{0:N}" HeaderText="Avail" SortExpression="QTY_AVAIL">
<asp:boundfield DataField="QTY_ADJUST" HeaderText="Adjust" SortExpression="QTY_ADJUST">
<asp:boundfield DataField="QTY_SHIP" HeaderText="Shipped" SortExpression="QTY_SHIP">
<asp:boundfield DataField="QTY_RECV" HeaderText="Recv" SortExpression="QTY_RECV">
<asp:boundfield DataField="PROD_DATE" HeaderText="Prod Date" SortExpression="PROD_DATE">
<asp:boundfield DataField="RELEASE_DATE" HeaderText="Release" SortExpression="RELEASE_DATE">
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle HorizontalAlign="Center" BackColor="#999999" ForeColor="Black" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" ForeColor="White" Font-Bold="True" />
<AlternatingRowStyle BackColor="#DCDCDC" />
<asp:SqlDataSource runat="server" id="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:RemoteRooster %>" SelectCommand="SELECT * FROM [INVENTRY] WHERE OWNER = 'CompanyName' AND QTY_ONHAND > '0'">

View 8 Replies

GridView In Webpart With Multiple Filters?

Apr 12, 2010

I'm currently working on a highly configurable Database Viewer webpart for WSS 3.0 which we are going to need for several customized sharepoint sites. but i fear it's necessary to recap the whole issue. As background information and to describe my problem as good as possible, I'll start by telling you what the webpart shall do:

Basically the webpart contains an UpdatePanel, which contains a GridView and an SqlDataSource. The select-query the Datasource uses can be set via webbrowseable properties or received from a consumer method from another webpart. Now i wanted to add a filtering feature to the webpart, so i want a dropdownlist in the headerrow for each column that should be filterable. As the select-query is completely dynamic and i don't know at design time which columns shall be filterable, i decided to add a webbrowseable property to contain an xml-formed string with filter information.

So i added the following into OnRowCreated of the gridview:

void gridView_RowCreated(object sender, GridViewRowEventArgs e)
if (e.Row.RowType == DataControlRowType.Header)
for (int i = 0; i < e.Row.Cells.Count; i++)
if (e.Row.Cells[i].GetType() == typeof(DataControlFieldHeaderCell))
string headerText = ((DataControlFieldHeaderCell)e.Row.Cells[i]).ContainingField.HeaderText;
// add sorting functionality
if (_allowSorting && !String.IsNullOrEmpty(headerText))
Label l = new Label();
l.Text = headerText;
l.ForeColor = Color.Blue;
l.Font.Bold = true;
l.ID = "Header" + i;
l.Attributes["title"] = "Sort by " + headerText;
l.Attributes["onmouseover"] = " = 'pointer'; = 'red'";
l.Attributes["onmouseout"] = " = 'blue'";
l.Attributes["onclick"] = "__doPostBack('" + panel.UniqueID + "','SortBy$" + headerText + "');";
// check if this column shall be filterable
if (!String.IsNullOrEmpty(filterXmlData))
XmlNode columnNode = GetColumnNode(headerText);
if (columnNode != null)
string dataValueField = columnNode.Attributes["DataValueField"] == null ? "" : columnNode.Attributes["DataValueField"].Value;
string filterQuery = columnNode.Attributes["FilterQuery"] == null ? "" : columnNode.Attributes["FilterQuery"].Value;
if (!String.IsNullOrEmpty(dataValueField) && !String.IsNullOrEmpty(filterQuery))
SqlDataSource ds = new SqlDataSource(_conStr, filterQuery);
DropDownList cbx = new DropDownList();
cbx.ID = "FilterCbx" + i;
cbx.Attributes["onchange"] = "__doPostBack('" + panel.UniqueID + "','SelectionChange$" + headerText + "$' + this.options[this.selectedIndex].value);";
cbx.Width = 150;
cbx.DataValueField = dataValueField;
cbx.DataSource = ds;
cbx.DataBound += new EventHandler(cbx_DataBound);
cbx.PreRender += new EventHandler(cbx_PreRender);

GetColumnNode() checks in the filter property, if there is a node for the current column, which contains information about the Field the DropDownList should bind to, and the query for filling in the items.

In cbx_PreRender() i check ViewState and select an item in case of a postback. In cbx_DataBound() i just add tooltips to the list items as the dropdownlist has a fixed width.

Previously, I used AutoPostback and SelectedIndexChanged of the DDL to filter the grid, but to my disappointment it was not always fired. Now i check __EVENTTARGET and __EVENTARGUMENT in OnLoad and call a function when the postback event was due to a selection change in a DDL:


When i have two or more filters set which return zero rows, and i change back one filter to something that should return rows, the gridview remains empty (although the pager is rendered). I have to completly refresh the page to reset the filters. When debugging, i can see in the overridden CreateChildControls of the grid, that the base method indeed returns > 0, but anyway.the gridView.RowCount remains 0 after databinding. Anyone have an idea what's going wrong here?

View 1 Replies

How To Refresh The Gridview After It Filters (Dynamic) Using LinqDataSource

Jul 29, 2010

AllowSorting="True" AutoGenerateColumns="False" DataSourceID="LinqDataSource1">

SortExpression="UserName" />
SortExpression="FullName" />
SortExpression="Email" />
SortExpression="LastLoginDate" DataFormatString="{0:dd MMMM yyyy}"/>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="MyDataContextDataContext" onselecting="LinqDataSource_Selecting">
<asp:Parameter Name="Subject" />
public void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
this.LinqDataSource1.WhereParameters["Subject"].DefaultValue = this.txtSubject.Text;
e.Result = reporterRepo.GetInquiries();

View 2 Replies

Custom Server Controls :: FilterExpression Not Working With Other Filters

Dec 21, 2010

I have a radgrid with multiple filters including DateTimePicker for From DateTime To DateTime.


View 2 Replies

Data Controls :: How To Add Header To Excel On Exporting Gridview To Excel Sheet

Feb 28, 2013

I'm exporting a Gridview to excel. I get all the gridview header and content in excel in addition to that i need to add a header text like report name in header of the excel sheet with line break in header.

I tried the solution in this link [URL] by adding

Table.Caption = "Header Text"
Table.CaptionAlign = TableCaptionAlign.Top
but i get error Reference to a non shared member requires an object reference.

View 1 Replies

Forms Data Controls :: How To Select Details From Microsoft Excel Sheet Without Writing Sheet Name

Jun 25, 2010

I am developing web application using csharp.How can I select details from Microsoft Excel sheet without writing sheet Name? At the moment when selecting details from Excel sheet I specify Excel sheet name like below I am using Payments$. Is it possible to use a number or something else.


View 2 Replies

Forms Data Controls :: Export From GridView To Excel Sheet?

Aug 19, 2010

I am having a bounded gridview through a database table. I am not showing all table's colum. there are 20 columns in databse table, but in gridview i am shoing only 5 coulmns.

Now I have button on the form on this button's click I can export all data i.e. whatever gridview showing means only 5 columns. But i need to export all 20 columns data to excel sheet.

How can I do that. (I can not show all 20 columns in gridview[this is requirement])

View 8 Replies

Forms Data Controls :: Export A Gridview To Excel Sheet?

Sep 10, 2010

i'm trying to export a gridview to a excel sheet. i tryied several examples but all examples shows only grid with boundfeilds.

here my gridview

<asp:GridView ID="transactiongrid" runat="server" AutoGenerateColumns="False"
<asp:TemplateField HeaderText="Transaction ID">
<asp:Label ID="TIDlbl" runat="server" Text='<%#Eval("TID") %>'></asp:Label>
<asp:TemplateField HeaderText="Customer No">
<asp:Label ID="CusIDlbl" runat="server" Text='<%#Eval("CusID") %>'></asp:Label>
<asp:TemplateField HeaderText="Customer Name">
<asp:Label ID="cusnamelbl" runat="server" Text='<%#Eval("FirstName")+" "+Eval("LastName")%>'></asp:Label>

View 7 Replies

Forms Data Controls :: Get One Excel File With 2 Sheet's From 2 GridView's?

Jan 25, 2011

I have one big problem for my, of course :)I have one page in my VB .NET website that contains 2 gridviews :GridView1 and GridView2I want to get one exel file with 2 sheets ( sheet A and Sheet B ), Sheet A want to contain data from GridView 1 and Sheet B i want to contain data from GridView 2I just know to save one excel file from one gridview, nd I'vesearched Google for some example but nothing for my case

View 2 Replies

Forms Data Controls :: Exporting Gridview Image To Excel Sheet

Feb 2, 2010

This is the class file im using to export the datagrid to excel sheet.Problem is i cant able to transfer the image from gridview to excel sheet using this code. What are the modifications i can do for the below code to export the image.

public class ExcelReport { # region Export to excel /// /// Function for Export html report to Excel sheet /// /// File name /// Gridview /// public void ExportToExcel(string fileName, GridView gv) { try { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("content-disposition",
string.Format("attachment; filename={0}", fileName)); HttpContext.Current.Response.ContentType = "application/ms-excel"; using (StringWriter sw = new StringWriter()) { using (HtmlTextWriter htw = new HtmlTextWriter(sw)) { Table table = new Table(); if (gv.HeaderRow
!= null) { //gv.HeaderRow.CssClass = "GridviewStyle"; // gv.HeaderRow.Font.Bold = true; PrepareControlForExport(gv.HeaderRow); table.Rows.Add(gv.HeaderRow); } foreach (GridViewRow row in gv.Rows) { //row.CssClass = "GridviewStyle"; // row.BorderColor = System.Drawing.Color.Blue;
// row.Height = 20; PrepareControlForExport(row); table.Rows.Add(row); } if (gv.FooterRow != null) { PrepareControlForExport(gv.FooterRow); table.Rows.Add(gv.FooterRow); } table.RenderControl(htw); HttpContext.Current.Response.Write(sw.ToString()); HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End(); } } } catch (Exception ex) { throw ex; } } private void PrepareControlForExport(Control control) { for (int i = 0; i < control.Controls.Count; i++) { Control current = control.Controls[i]; if (current is LinkButton) { control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as LinkButton).Text)); } else if (current is ImageButton) { control.Controls.Remove(current); control.Controls.AddAt(i, new LiteralControl((current as ImageButton).AlternateText)); } else if (current is....................................

View 1 Replies

Forms Data Controls :: Transfer The Image From Gridview To Excel Sheet

Feb 2, 2010

This is the class file im using to export the datagrid to excel sheet. Problem is i cant able to transfer the image from gridview to excel sheet using this code. What are the modifications i can do for the below code to export the image.

public class ExcelReport
# region Export to excel
/// <summary>
/// Function for Export html report to Excel sheet
/// </summary>
/// <param name="fileName">File name</param>
/// <param name="gv">Gridview</param>
public void ExportToExcel(string fileName, GridView gv)
HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", fileName));
HttpContext.Current.Response.ContentType = "application/ms-excel";
using (StringWriter sw = new StringWriter())
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
Table table = new Table();
if (gv.HeaderRow != null)
//gv.HeaderRow.CssClass = "GridviewStyle";
// gv.HeaderRow.Font.Bold = true;

View 2 Replies

Forms Data Controls :: Develop A GridView Similar To Excel Sheet?

Feb 6, 2010

I was requested to develop a GridView like screen to allow easy DataEntry without the need to Click Save/Submit on each row of the GridView.

In other words, the user wants to edit the GridView Cells in a Web Screen as if he is editing Cells in MS Excel. The Data should be saved as soon as he will exit the cell by pressing the down arrow.

It think the only way to do that is to use Ajax technology, right ?

Maybe jQuery or ExtJS ?

View 8 Replies

How To Retain The Values Of The Filters And Its Result Using C#

Mar 17, 2010


Page is a typical search page with few filters on it. When search for records based on filters, it shows result in Gridview. From grid view records, user can click on any record to see the details which takes the focus on new page. Its working fine so far.Now when user comes back from details page to search page. I am loosing selected filters values and no result in grid view.How can i display selected filters and its results in gridview when user is coming back on search page? Any example etc.?

View 2 Replies

Access :: Create A Query From Filters?

Jan 25, 2011

am a bit unsure of the best way to go about this. I have a form where data is entered, date ranges, usernames, passwords etc and when the button is pressed on the form it searches a database and returns values which match the values entered.I can't think of the most efficient way to do this, could anyone give some pointers on where to start?I thought perhaps of writing a query and then just putting in the variables which pick up the entered values and reading it all in as one big string something like:

SELECT * FROM DB WHERE ProductID = "DateTxtBox" & "NameTxtBox"

I haven't checked the syntax but this is just to give you a idea of what I am thinking.

View 5 Replies

MVC3 Make Possible To Use IOC With Action Filters?

Aug 22, 2010

Will MVC3 make possible to use IOC with Action Filters? Is this on the roadmap?

View 1 Replies

Forms Data Controls :: Import Excel Sheet Data Into Dataset Or Gridview And Save To DB?

Mar 2, 2011

i am use this code for read excel file:


how to read special cells in excel and I save to DB.

for example: B4 and C4 is merged with named to read Data of this cell.

View 4 Replies

Grid View Filters / How To Set Filter Two Or More Than Two Columns

Feb 21, 2011

Am running application with gridview.Am using filters to filter only one column.Now i want to filter two or more than two columns.How to i set the filters for that..if i give && or|| operators it is showing syntax error..

i given the code as;
ProviderName="<%$ ConnectionStrings:booksConnectionString.ProviderName %>"
SelectCommand="SELECT * FROM [book]"
FilterExpression="UserName Like '{0}%' || Password Like '{0}%'" >

View 1 Replies

MVC :: Understanding With Searchresults And Dropdown Filters In The Same View

Jun 22, 2010

I am new to ASP.NET MVC 2 and I am having a very hard time figuring out how to do even the most simple things. I have a couple of books on ASP.NET MVC as reference but I cannot find any answer to my question. Here is what I basicalyl have and need:

I am trying to create a page that shows me a table that contains some Product Statistics with columns such as Date, ProductCount, PriceCount. On the same page I want to add some filters such as "Product category" (dropdown) and a date from and date to (jquery ui datepicker). When a user clicks on "Filter" it should reload the page and in the Product Statistics it should show the statistics filtered by "Product Category" and the date range. At the same time I want to make sure that the selected Product Category from the dropdown list does not get lost, the same for the date pickers.

I have a GlobalReportController with two actions: "Index" and "Filter". I have also a GlobalReportIndexViewModel and a ReportFilter. In the "Index" action, I retrieve the complete list of statistics and product categories and fill up the ProductStatisticsIndexViewModel.

I am having a whole lot of problems trying to grasp how the ASP.NET MVC paradigm works exactly.

View 8 Replies

C# - Filter Sql Server Table Rows Using Many Filters

Mar 23, 2011

I have a table called Student with a lot foreign keys that will be used after to filter students(table rows).The structure of this table is like:

StudentId GenderId DegreeId NatioanlityId
1 2 2 3

As a student can speak one or more language,the Sudent Table is linked to language table like this

StudentId LangaugeId
1 1
1 2
1 3

And a student can chose one or many subjects for exam:

StudentId ExamId
1 1
1 2

In my page I would like to filter students via checkbox using ajax for example, student having female and male gender with Degree 1,speaking language 1,2... I filter rows in a stored proc using user defined table,and I have to use a lot of IF statements like this

if(EXISTS(SELECT GenderId FROM @GenderTable))
if(EXISTS(SELECT DegreeId FROM @DegreeTable))

How can I avoid all the IF statements? I have more than 5 filters.It's boring.

View 1 Replies

C# - Getting Action Filters List From Base Controller?

Feb 23, 2010

In Short: Does any know a way from the base controller to get a list of actionFilters being applied to the current executing action?

The Long:I am using ASP.NET MVC 1.0 framework. I have a "RequireSSL" actionFilter that I've recreated for checking out, however, if someone leaves the checkout and goes back to the store I would like to forward them back to non-secure version of the site.It would be helpful in the base controller (I am using a custom base controller that inherits from the default Controller) to find out what actionFilters are being applied to the current action.I could include this into the global.asax.cs

View 2 Replies

Extend QueryableFilterRepeater To Override The Filters Shown?

Apr 21, 2010

In previous versions of DynamicData you could override GetFilteredColumns method from FilterRepeater to manage which columns are used to generate filters.

But now FilterRepeater is obsolete, and his successor QueryableFilterRepeater don't have such method.

There is any way to override the columns used for filtering with QueryableFilterRepeater?

View 1 Replies

Copyrights 2005-15, All rights reserved