.net

Why does a simple entity data model relationship return null instead of a reference to an object?

I have 2 simple tables and a foreign key defined in SQL Server Express: Product ProductID [auto-inc] Name CompanyID [not-null] Company CompanyID [auto-inc] Name FK_Product_Company Product.CompanyID = Company.CompanyID I created an ADO.NET Entity Data Model and added all the tables to it. The .edmx file shows the 1-to-ma...

How to add Item to SqlDataSource databound list

I am lazy - and I am using a SQLDataSource to populate my dropdownLists. The Databind event for the databound objects is called before the Page.PreRender so I am doing something like this in the PreRender eventHandler: private void InitializeDropDown() { this.myDropDown.Items.Insert(0, new ListItem("-- Select someth...

Using XSLT to output an empty HTML textarea element

When attempting to output an empty textarea element, the .NET XSLT processor collapses the element to its short form. Instead of this: <textarea id="blah" name="blah"></textarea> I get this: <textarea id="blah" name="blah"/> Which causes many web browsers (including IE and Firefox) to render the rest of the page as if it were the c...

simple xml parsing

what is the simplest way to parse the lat and long out of the following xml fragment. There is no namespace etc. It is in a string variable. not a stream. <poi> <city>stockholm</city> <country>sweden</country> <gpoint> <lat>51.1</lat> <lng>67.98</lng> </gpoint> </poi> everything I have read so...

Implementing captcha in a stateless REST web-service environment

The project I'm working on is a piece of static HTML with some inline JavaScript that will call a REST web-service, which I'm creating myself using .NET 3.5 WCF. The JavaScript will grab some details from the user including an email address, then send those details off to the web-service through Ajax. The web-service will then store the...

Platform agnostic .NET bitness - from OS or calling application?

I know that platform agnostic .NET applications "float up" to the bitness of the operating system. But what about a .NET assembly that is a library, not an executable, being called from a non-.NET application? We have a .NET DLL that is a CLR extended stored procedure for SQL Server 2005. Currently it is platform agnostic. What happens ...

Program Terminates On File Move

I have a .Net program that, as one of its functions, takes a file from a user-specified directory and puts it in another, special, directory, specified via UNC (which may or may not be local). I don't open any of these files in this part of the code. There's this bizarre bug I'm having where, on a Windows Server 2003 SP2 VM, this progra...

Why do we still use DataSets in .NET?

DataSets were one of the big things in .NET 1.0 and even now when using .NET 3.5 I still find myself having to use them....especially when I have to call a stored proc which returns a dataset which I then end up having to manually transform into an object to make it easier to work with. I've never really liked DataSets and have found th...

What are some good resources on doing text-to-speech in .NET?

Can anybody help me with Text to Speech Engine in C# ...

Why am I getting a System.Security.Permissions.SecurityPermission error in my .NET Application?

I am trying to develop a text-to-speech editor in .NET 3.5 using C#. I encountered the following exception: System.Security.Permissions.SecurityPermission. How to handle it? ...

How do I reliably get an image dimensions in .NET without loading the image?

I know how to get the size (x,y) of an image Image.FromFile("cat.jpg").Size BUT that requires loading the image from memory. When I view the images in Windows Explorer it shows me the size. How do I access that size? Is it reliable for all images? Does Windows explorer need to have 'seen' the image first for the size to be availabl...

Need to generate a image in ASP.Net through webservice

For my new asp.net application that I am developing I would like to generate an image at runtime using a webservice (return bytes), and show this as a image using Javascript (so that I can have ajax functionality. Any ideas how to do this? Or any ideas as to how I can generate an image at runtime, and show it on my webpage using Ajax (...

How to call StoredProcedure from CrystalReport?

Hi all. I'd like to call a Stored Procedure from a crystal report and assign retrieved value to a field in report? Any suggestions? ...

Possible reasons for FileStream.Write() to throw an OutOfMemoryException?

I have 10 threads writing thousands of small buffers (16-30 bytes each) to a huge file in random positions. Some of the threads throw OutOfMemoryException on FileStream.Write() opreation. What is causing the OutOfMemoryException ? What to look for? I'm using the FileStream like this (for every written item - this code runs from 10 dif...

How to gain control over the construction of a WebService

Hi, I'd like to gain control over the construction of a WebService instance in ASP.NET. This is what I did so far: I created a .ASMX file and pointed it to a Class with WebServiceBinding and WebMethod attributes attached to it as usual. At the time I browse to the .ASMX file ASP.NET will automatically create an instance of the Class fo...

.NET Http file upload intermittent problems

We have had problems for the past year whereby when users upload files to the server very few files will just not upload via a simple HTTP form. These files have been of varying sizes and types but for some reason they will not upload. Often ZIPing them up will help resolve the problem but ideally the user should not have to do this an...

What for should I mark private variables as private if they already are?

Hello. As far as I know, in C# all fields are private for default, if not marked otherwise. class Foo { private string bar; } class Foo { string bar; } I guess these two declarations are equal. So my question is: what for should I mark private variables as private if they already are private? ...

Where do we instantiate view and presenter in Passive View on WinForm?

I am new to Passive view, I would like to know if we have master and detail form on WinForm application. So when the user clicks on master's button, it will shows the detail form. Where do we instantiate view and presenter? I don't think, we instantiate at code behind of form. But if we instantiate at presenter's method, it means we coup...

How to query the print queue on Windows

We are developing a critical application and need to have the finest control over the documents printed. To be sure on which documents are printed or not we want to check the printer queue. How can we query the print queue on Windows (status, queue list, errors, ...)? ...

Updating WPF list when item changes

I have a WPF ListBox, and I've added some 'FooBar' objects as items (by code). FooBars aren't WPF objects, just dumb class with an overwritten ToString() function. Now, when I change a property which influences the ToString, I'd like to get the ListBox to update. How can I do this 'quick and dirty' (like repaint). Is dependency proper...