.net

Dynamic changes in ASP:GridView column

Hello, I have created a GridView whose columns are dynamically created based on my data source. One of the column is a status field which displays Yes?No image based on the status field in database. <asp:TemplateField HeaderText="Status"> <ItemTemplate> <asp:Image ...

How to use Case Statement

Using C#.Net and MYSQL I want to use a CASE Statement like SQL Query SELECT vehicleno, brandname, CASE WHEN inexpire < 0 THEN 'Expired' ELSE inexpire END AS inexpire FROM (SELECT Concat(plateno, vehicleno) AS vehicleno, brandname, Datediff(inedate, Curdat...

Need help in Linq

I am writing a Linq query just for learning. var result = Process.GetProcesses() .Where(p => p.WorkingSet64 > 20 * 1024 * 1024) .OrderByDescending(p => p.WorkingSet64) .Select(p => new {p.Id,p.ProcessName,p.WorkingSet64 }); I want to iterate in to result foreach(process in result) ...

Does ASP.NET MVC have a Decimal route constraint baked in?

Does ASP.NET MVC have a decimal route constraint baked into the core library? I know there's the Regex Constraint but I was wondering if there's any others? ...

Linq to Dataset - joining tables

I write a statistical application: I have a dataset with many tables; all of them have one key field (int) – the first field, and an unknown number of other fields (double). I already built an output table, with the same structure. I plan to join the tables that the user selects, iteratively, to the output table, one at a time. It's a l...

XSLT extenison function call esacapes backslash

When I call an extension c# function like this: <xsl:choose> <xsl:when test="extension:matches('\d', .)"> <td bgcolor="#ff00ff"> <xsl:value-of select="blah"/></td> </xsl:when> <xsl:otherwise> <td><xsl:value-of select="blub"/></td> </xsl:otherwise> </xsl:choose> Then the functions receives as first argument "\\d". ...

How to avoid XmlSerializer failure if process environment is too large?

Hi, I ran into a strange problem last week. A call to new XMLSerializer(typeof(MyType)) crashed with an ExternalException, telling me that csc.exe could not be executed. After some investigation I found that this exception only occurs if the process environment size reaches a "critical" limit. I created a little sample application to ve...

Event handler on .Net library object not firing off object run on STA thread

I have an object which is running on an STA thread. Sub MyAsyncTask() Do MyWorker = New JobWorker() MyWorker.Work() Loop End Sub Protected InnerThread As New Thread(AddressOf Me.MyAsyncTask) Public Sub Start() Started = Now InnerThread.SetApartmentState(ApartmentState.STA) Inn...

Using Global Assembly Cache (GAC) - in the way it was designed to

Is the following solution the only possibility to use libraries from GAC in code? Assembly lib = Assembly.Load("MyLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31f5625abd53197f"); Console.WriteLine(lib.GetType("MyClass").GetMethod("Start").Invoke(obj, null)); I am a little bit confused - I've read quite much about GAC and...

File is used by another process. How to know which process?

I keep getting that exception in my program. How do I know which process locked it, either by program code or by doing something with windows? System.IO.IOException : The process cannot access the file 'file.ext' because it is being used by another process. ...

WPF - Assign F-keys to buttons

I know about "_" instead of "&" but how to assign F1,F2... key to a button ? It's a small application, i'm not using Commands just straight click event handlers but I could use commands if necessary ...

Purpose of automatic properties in .NET.

Why is this: public string Foo {get;set;} considered better than this: public string Foo; I can't for the life of me work it out. Thanks David ...

Framework for .net Reflection.Emit simplification?

Is there a framework, that makes the use of of Reflection.Emit easier? Something I can tell: Give me a class with a string field and get,set accessors. The code I find in Create a class type in code in .net c# is what I need, but it is somewhat cryptic. I think a library with a simplified interface would boost productivity. ...

How can I prevent the direct call of an URL in an ASP.NET / IIS environment?

How can I achieve in an ASP.NET application, that a set of URLs/ASPX pages (parts of the application) cannot be called directly from the user in the Browser? These urls/pages may only be referenced in the application itself. ...

Updating GUI from a different class?

Perhaps this is a very basic question, please pardon me if it is --- I'm a beginner in C#. I have a WPF GUI for sending commands to a receiver. The commands are ASCII texts. Now, I separated the communication part into a separate project because I have console applications that use the communication methods in addition to the GUI. The c...

VB Style CD Embedding with .Net Framework

Hi there, In the old VB6 days it was possible to embed the runtime onto a cd and run the app automatically when the CD was popped in without having to run through an installation. Is there anything available in .Net that mimics this? Thanks Jacques ...

Should I use .NET/Mono/Tao/OpenTK/... something else?

Hi, I'm pretty confused by the multitude of frameworks to choose from: I would like to be cross platform, possible even try to make an application for my mobile phone. Probably a game, but could be something else. Can I use something else apart from Xna with the Windows Phone? One of the aforementioned frameworks. Tao says that it is a...

Compiling for older version of .net in VS2010

Is it possible to compile using an older version of .net framework while using VS2010? (which requires .net 4 to run if I'm not mistaken). If so -how is it done? ...

Loading a file to a Bitmap but leaving the original file intact.

How to do this in C#? If I use Bitmap.FromFile(), the original file is locked. If I use Bitmap.FromStream(), the original file is not locked, but the documentation says "You must keep the stream open for the lifetime of the Image." This probably means that the file is still linked to the image object, (for example, perhaps if the file ...

Line numbers and parameter values in browser error messages in Silverlight

So far i have not found any solution to this problem. There are many questions about this when i google it, but none of the discussion ends with some conclusion. I want to have line number in stack trace whenever an exception is thrown in silverlight application. Something like this: System.NullReferenceExceptinon SL runtime method...