C# - How To Filter GetFiles With Multiple Extensions
Aug 19, 2010How do you filter on more than one extension?
I've tried:
FileInfo[] Files = dinfo.GetFiles("*.jpg;*.tiff;*.bmp");
FileInfo[] Files = dinfo.GetFiles("*.jpg,*.tiff,*.bmp");
How do you filter on more than one extension?
I've tried:
FileInfo[] Files = dinfo.GetFiles("*.jpg;*.tiff;*.bmp");
FileInfo[] Files = dinfo.GetFiles("*.jpg,*.tiff,*.bmp");
I'm having trouble moving a website from one server to another. It seems to be a problem loading multiple versions of System.Web.Extensions. The code uses version 3.5 in most places but a third party control appears to be needing version 1.0.6. I didn't think this was possible but it appears to be working in it's current situation.
Is there a way I can use the GAC version of System.Web.Extensions for the site but import a dll of version 1.0.6 just for these controls?
I'm searching folders using the following code. Is it possible to use this code to search for *.mp4, *.mp3, and *.m4v files instead of just *.mp4 files?
[Code]....
I want search with multiple names in Name coloumn. example I have pass the criteria to Name cloumn is 'Atul', 'Mayur', 'Suraj' this three names how to pass in a query.
View 1 RepliesI am populating a data bound control DropDownList with file names from a local folder that resides within a ListView control.
I am able to populate as expected, in testing list is generated - all good in that regard.
However once I set to databind by adding SelectedValue='<%# Bind("ImageFile") %>'the following error occurs
ERROR:Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
This is the aspx file .. no codebehind:
#CODE SNIP #
[Code]....
VWD 2008 Express. Visual Basic.
I am using the Directory.GetFiles method as follows:
[Code]....
As expected, it returns files with the ".pdf" extension. I would like to be able to specify more than one extension (like "*.doc*" and "*.txt*", etc.). How can I use GetFiles to return files with more than one desired extension, without returning all files?
the maximum number of files in a folder, I noticed that DirectoryInfo.GetFiles().Length is returning a System.In32, but the Maximum value of a Int32 is 2.147.483.647 (Int32.MaxValue) while on NTFS (an many other filesystems) the maximum number of files can go far beyond that.
on NTFS it is 4.294.967.295 single files in one folder (probably an Uint32)
Which leads me to the interesting question:
Is it possible to get the number of files in a folder on NTFS with the .NET framework, when the number of files exceeds the Int32.MaxValue, in an elegant and performing manner?
Is there a way to get a file count in a folder, but I want to exclude files with extension jpg?
Directory.GetFiles("c:\Temp\").Count();
I am doing some aggregates on in memory tables using the DataTable.Compute method. It works file if there is only one filter, however when there is multiples then it does not work.
This first one works fine the second one does not.
[Code]....
My requirement is to show a page with multiple filters to apply to grid data.
Suppose we are talking about Orders and an order has the following attributes
public class Order {
public int OrderID
public DateTime OrderDate
public DateTime ShipmentDate
public int OrderTotal
public int OrderStatus
}
Inside the jqgrid object I am showing all the attributes except the OrderStatus
The requirement is to create a view that has the jqGrid on the left part a panel on the right
Inside the right panel the user will see a list of checkboxes that represents every possible OrderStatus value and he want to search using both methods (for example selecting the checkbox "Shipped Orders" and then filtering the grid with Amount greater than a value)
I have already configured the advanced filtering (multiplesearch:true) inside the jqGrid object and I am able to create complex filters combining fields and logical operators.
how I can submit even the data from the right panel when the user press the search button?
Update 1:
Preamble: Oleg sample is fantastic but unfortunately does not fits requirements of my customer :(
@Oleg: I do not understand why you think that:
If the data are outside of the grid you will be show the order details on the right pane only for selected row. So the user will have not so good overview of the data.
maybe my description was not so clear but I am not going to show any order detail. To better clarify my requirement I have modified your sample to show you the desired final UI which is as in the following image:
The customer want to filter the data in the grid using two methods or both together:
Using the multiplesearch facilities provided by the grid itself (thanks for the workaround mention) Using the custom Search Panel (the one with the checkboxes on the right) provided
From a functional point of view the requirement is very easy to express: When the user click on a checkbox or make a search using the native multiplesearch I should post values to the server including also the checkboxes state.
To summarize I should:
Add the checkboxes state when a post is made through the native multiplesearch
Add the current multiplesearch state (if any) when the user click on a checkbox
i have 4 dropdown controls.i have to search for data from ms-sql by selecting the dropdownd if dropdown has all values then ihow an i write query in where condition?
View 1 RepliesI saw link [URL] ....., that is great , so i have one query .
How to filter gridview with 4 checkboxlists for Product search
CheckboxList2 -DISCOUNT CheckboxList3 - Price CheckboxList4 - BRAND CheckboxList5 - Category
but one think is that without removing any checked data on checkboxlist when select any checkboxlist item. like snapdeal,flipkart etc ....
In my application i need to filter a gridview using four or five parameter.
View 3 RepliesI have a listview with 4 columns. I want to filter the data based on what's typed in the 4 textboxes above the listview. I'm using an Access DB and running .NET 4.0. From what I've read, I need to call a function using 'OnTextChanged' from my textboxes. Has anyone done this before? Am I on the right track by calling a function or do I need to use something like LINQ?
View 9 Repliesi am stucked in Checkbox Filteration issue... My problem is If first checkbox list is checked and user clicks on second checkbox list then i want to compare both checkboxes and populate result based on both checkboxes. using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
[code]...
I have been stuck on an issue that is driving me mad and I bet its simple. I have a Textbox with a gridview and a LINQ statement in code behind that populates the data source of the gridview at page load.
The Textbox is used as a filter for the where clause in the Linq statement. All works as expected however I want to be able to use more than one word as a filter. This is the problem. I take the textbox string and convert to an array
Dim aryTextFile() As String = SearchString.Split(",")
But I need to figure how to pass the values of the array as parameters for the Linq Statement. I need to return all rows that have either a match for LocationName AND/OR Address AND/OR City. I thought of something like this but it fails.
Dim db As New DCLocationsDataContext
Dim q = From t In db.Locations _
Where t.City AndAlso t.LocationName AndAlso t.Address Like aryTextFile _
Select t
GridView1.DataSource = q
GridView1.DataBind()
how can I filter a gridview with two textboxes, where the condition is either to search with one or two textboxes ?my code I have tried with no succes
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="_Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> [code].....
I have following situation
1. I have gridview which is bind with sql data source column name industry
2. I have checkbox list which has all industry name,
3. I want to pass checkboxlist selected value to sql data souce to filter data in gridview.
I have a calendar that can have multiple dates non sequentially selected. I have a gridview on the page with a sqldatasource control bound to it.
Again, I have already built the events calendar with the ability to select multiple dates... now I just want to show those detailed records below the calendar for only the dates selected.
How do I filter the records to only get the records of the SelectedDates of the Calendar control.
This has to be done dynamically in the code behind.
My question is I have multiple Checkbox Lists and i want to compare it and Filter Datalist records on Checkbox list checked event.. (I want filtering something like [URL]
using System;
using System.Collections.Generic;
using System.Linq;
[Code].....
My problem is If first checkbox list is checked and user clicks on second checkbox list then i want to compare both checkboxes and populate result based on both checkboxes.
I've created a filter textbox for searching my data in gridview..
ex: i've 3 columns in gridview : ID, NAME, DATE
I ask, how to create a dynamic search for 3 columns in gridview using a textbox?
without writing a query repeatedly :(ID like '%" + search + "%') OR (NAME like '%" + search + "%') OR (DATE like '%" + search + "%')
protected void btnCariConnStrSubmit_Click(object sender, EventArgs e) {
string search = ((TextBox)GridView1.HeaderRow.FindControl("txtCariConnStr")).Text;
string sql = "select * from report where (ID like '%" + search + "%') OR (NAME like '%" + search + "%') OR (DATE like '%" + search + "%') ";
reader = mda.GetData(sql, connStr).CreateDataReader();
if (reader.Read()) { dt = mda.GetData(sql, connStr).Tables[0]; BindGridView(dt); lblRecordNotFound.Visible = false; }
else { Bindemptydt(); lblRecordNotFound.Visible = true; }
((TextBox)GridView1.HeaderRow.FindControl("txtCariConnStr")).Text = search;
}
I need good css for Gridview just like the mac css
can we provide the filter functionality to gridview like the excel filter.
In securing actions/controllers, do I have to create a custom filter or use MVC built-in filter?
To use the built-in attribute Authorize() on an action/controller or create a separate class that inherits the ActionFilterAttribute which has a method (OnActionExecuting) to override and do the authentication there?
In my organization we use nested groups. For a particular usage, we have a group (let's assume that the group name "kuku"), and the names of all the nested groups under it contains "kuku" as well.
We may assume that no other group in the LDAP has "kuku" in the name.
I need to create a filter which will return all the users which belong to one of the "kuku"s group.
Obviously, using this filter will bring only the head kukus
(&(&(objectclass=user)(objectclass=person))(memberOf=CN=kuku,cn=...rest of the group DN...))
How can I use wild card to fetch all users which belong to any kuku?
For example: (&(&(objectclass=user)(objectclass=person))(memberOf=CN=.*kuku.*))
I have decorated my base controller with a couple of action filters. They work fine.
One of those filters sets up the request - does things like set the culture based on the domain, etc.
I also have a handful of actions that require authorization using the Authorize attribute.
My problem is that when an user attempts to request a page they are not authorized to access, the authorization filter kicks in and redirects them to a page telling them that they cannot vie the page.
The issue is that the action filters never run so the culture and other request data is never set. This effectively causes language to be wrong in the view and other data to be missing.
I know that authorization filters run first but my question is this: How can I design this such that I can ensure that certain methods are always run before the view is returned, regardless of the authorization.