Was Asp.net GridView able to use ViewState?

I'm working on an old site that originated as a Visual Studio Website project, and which I'm converting to a Web Application in addition to other work. One page on the site uses a GridView, and sets the DataSource in code-behind using a DataTable. Th

How can I convert this SQL to LINQ

I've created a code-first database and the question is that I'm having some difficulty transcribing this SQL statement into the C# code. Below there's the SQL statement that I require help on adapting and the tables that I currently use. The objectiv

When is garbage collection triggered in C #?

I read many things about garbage collection like it's generation, scope etc but want to know when does the garbage collection gets triggered ? an example will be really helpful if possible. Thanks,Garbage collection occurs when one of the following c

Check for .NET 4.0 using Wix

I'm trying to modify an existing Wix script to check that .NET 4.0, rather than .NET 2.0 is installed before proceeding. This is currently done using a custom action in the wxs file: <InstallUISequence> <Custom Action="VSDCA_VsdLaunchConditi

Uri (Uri, String) constructor does not work properly?

Here is a part of my code: Uri branches = new Uri(@""); Uri testBranch = new Uri(branches, "test"); I expect testBranches will be

Can be installed in a VS2012 vanilla

I am interested in using a ruby script (https://github.com/zmoazeni/csscss) withing an ASPNET MVC site. I have no previous experience with ruby so my question could be naive. Is it possible to import the ironruby nuget package and execute the ruby sc

C # SQlite connection string format

I have a 2 part question here 1) I downloaded SQLite from here: SQLite Website and for .NET 4.5 there was a "mixed" mode version and the "non-mixed mode" version. How do I know which one I should use? When making a connection I use the

Caching in the Windows application .Net

I am working in a windows based application which uses master data for every transaction. This master data normally doesn't change but in some cases it can be change. I am fetching this data into cache or DataSet once and use it for future transactio

What if cmd can not display some characters?

If Im using c# I like to display my output on the console. Thats fine, but sometimes cmd is not able to show some characters. Like '€' , I only get '?' and thats not an encoding problem in my c# code, cmd is just not able to display '€' - so how to s

how to delete cookies in asp.net

I would like to know can we delete cookie from cookies collection what we have created in asp.net website.I tried & find Expiration Logic.It works but it shows in browser cookie. Response.Cookies["UserID"].Expires = DateTime.Now.AddDays(-1);

Choosing between WPF and Windows Forms Applications

Now I'm in position to start a new project. Until now I always choose the WFA. Now I want to know what is the creteria of choosing WPF or WFA. What is the motivation for choose. ADDITIONAL INFORMATIONS The project refers to: Handle incoming mails Cra

Would like to have a generic Wrapper class available

For inheritance purposes I would like to have the following class, which I cannot write myself, available: class Wrapper<G> : G { public Wrapper(G base); protected G GetBase(); } It would inherit all members of G as asual, and all usages of these me

How to declare a nested function in VB.NET?

How would I declare a nested function in VB.NET? For example, I want to do something like this: Function one() Function two() End Function End Function However, this statement is invalid in VB.NET because of unclosed function.Are you asking how to wr

Silverlight strange bug with bitmap and WebClient images

I have strange bug with showing image in silverlight. The problem to show list of images that configured in xml file and this xml downloaded from server by WebClient type. WebClient client = new WebClient(); client.AllowReadStreamBuffering = true; cl

.net memory profiler that can profile remote machines

I own the Ants Profiler 4 which is great for performance / memory profiling. Unfortunately it only works on the local machine and I cannot attach to a running process. But I have a memory leak that only seems to occure on our production server. A win

Error in the generic repository method for Entity Framework

I'm trying to create a generic method to use in my base class for my repositories and I'm having an issue. Here's the method... public virtual T First(System.Linq.Expressions.Expression<Func<T, bool>> where, List<string> properties) { IQ

Is SynchronizationContext.Post () is threadsafe?

This is a pretty basic question, and I imagine that it is, but I can't find any definitive answer. Is SynchronizationContext.Post() threadsafe? I have a member variable which holds the main thread's context, and _context.Post() is being called from m

c # Write to a file without using {}

I'm writing a little application whereby I want to write the results of the operations to a file. Basically what I want to do is open a stream to a file (I'm thinking FileStream, but am open to suggestions), write data to the file, then close it at a

Why can not I change the Thread.Name in .NET?

System.Threading.Thread.Name is a write-once property. I can assign to it at once, and only then if no other assignment has been made by application or library code. I am writing a multi-threaded event-driven application and would very much like to b

Try to find the first 3 properties of a POCO instance

I have a simple POCO class that contains the student's scores. For example: Math - 83% Engrish - 82% Chemistry - 81% Drama - 100% etc.. Is there a way (using LINQ?) that I could figure out the top 3 properties ordered by score? I'm assuming the final

How do you pass a message from one program to another?

I have a .Net 3.0 application that needs to pass an integer to another program on the same machine. I was using a WCF service to do this, but ran into user rights issues when trying HOSTING the service on the local box. Any thoughts on how to accompl

Verifying the existence before insertion via Linq to SQL

I'd like to know if there's an easier way to batch insert a set of records if they don't already exist in a table. For example I have a Tags table in the database having ID, Name columns - given a list of tag names I want to add only those that are n

How do I set the default proxy to use the default credentials?

The following code works for me: var webProxy = WebProxy.GetDefaultProxy(); webProxy.UseDefaultCredentials = true; WebRequest.DefaultWebProxy = webProxy; Unfortunately, WebProxy.GetDefaultProxy() is deprecated. What else should I be doing? (using app