.net

RequiredFieldValidator Issue

My requiredfield control is validating the "SEL"(default invalid value) value but when I do change the value to a valid one, the ErrorMessage/Text does not disappear until I submit the form again. <asp:DropDownList ID="ddlDocumentType" runat="server" DataTextField="Description" DataValueField="Code" /> <asp:RequiredFieldValidator Contr...

Why does ceiling in .NET return a Double and not an integer?

As explained here, Math.Ceiling returns: "The smallest integral value that is greater than or equal to a". But later it says: "Note that this method returns a Double type instead of an integral type." I'm just wondering why? ...

how can i clear the configurationmanager cache for connectionstrings

I am trying to change the database name in the connectionstring located in the App.Config of our servicehost at runtime and restart it afterwards connecting to another database. This works fine, but only if the application is shut down for multiple seconds. Shutting down the application for several seconds seems to clear the cache of th...

Refresh property grid, at Design-time, when a readonly collection changes in .Net, Winforms

I have a class that has a readonly collection property - Its a list of extender providers that have been applied to the control. I've implemented a simple property descriptor for the collection so that the property can be expanded in the property grid to examine each entry. When I select an extender provider and set it to false, I remo...

Calling an application from a server

Hey guys, I have an (console, .NET 3.5, C#) application that I'm trying to call from a Windows Server (2003, with .NET 3.5) from a system (Windows server 2003 with .NET 2.0) via a scheduler (the scheduler app is called 24x7, it's a script based scheduler, in this case, it calls the executable strait up, no parameters, etc). The issue is...

Opposite of "always on top"

I want to set my application to be on desktop level, like Windows Gadgets. Is this possible to achieve? Thing is, i have borderless application I want to run on desktop. I tried to find the option, but I found only "always on top" which is opposite of what I want to achieve. ...

Duplicate classes in my wcf proxy

Okay, I have two OperationContracts and MessageContracts, like this: [OperationContract] OperationResult OperationOnSingleItem(Input input) [OperationContract] OperationResult OperationOnItemCollection(Inputs inputs) [MessageContract] public class Inputs { [MessageBodyMember] Input[] InputCollection } [MessageContract] public...

When you use flag(Enum) you have a limit of 64. What are the alternative when you reach the limit?

With enum under .net the biggest number you can use is ULong. This mean a maximum of 64 flags. What would be the alternative when you need more than 64 flags? Edit Sorry, I forgot to add this, alternative that would still work with bitwise operations at least these one; and and or. using Josh Einstein suggestion, I came up with this...

How Do LINQ TO SQL Stored Procedure Calls Work?

I have a LINQ TO SQL Context that I have created that calls a stored proc. When I'm looping through the ISingleResult is it creating entities on the fly while the underlying DataReader reads the results or does it put every thing into Entities upfront before the function call returns. Basically what is going on is I'm working with a sto...

Switching from Windows Form to Web Form

I created a Windows Form executable in .NET 3.5 that uses a dll to communicate with a machine that scans checks. I'm eventually going to need to move from an executable to a Web Form that can do the same thing. This will be months from now, but I wanted to start doing the research now as I have not done this before. I'm going to need ...

ASP.NET MVC - Server software requirements?

I've just today learned of asp.net mvc, and I'm wondering what is needed from the server-side to host this. I suppose IIS 6 (and newer) and the .NET 3.5, is there anything else you need? ...

Convert Open XML Excel files to HTML

I'm developing printing solution for MS Office 2007. Office automation is not right for me, because it requires Office to be installed. Open XML Document Viewer is solution for converting Word files (.docx) to HTML format by XSLT transform, but it works only for .docx. Can the same technology be used for Excel spreadsheets files? ...

Is there a way to keep track of the ordering of items in a dictionary?

I have a Dictionary<Guid, ElementViewModel>. (ElementViewModel is our own complex type.) I add items to the dictionary with a stock standard items.Add(Guid.NewGuid, new ElementViewModel() { /*setters go here*/ });, At a later stage I remove some or all of these items. A simplistic view of my ElementViewModel is this: class ElementVi...

WMEncoder merge wmv files

how I can merge two or more wmv files using WMEncoder without lose quality. I'm using next code. but output file has very low quality(is unusable). Note: files were created with the same profile as for output. public void Merge(ICollection<string> files, string output, string profileName) { WMEncoder Encoder = new WMEncode...

Set x-axis scales for Date/Time values in .NET charting

I'm importing some data from MySQL into a VB.NET application with .NET charts. At the moment, the chart is plotting points by date, which means that when you zoom in, each major tick mark simply displays the date. See http://www.oliverspencer.com/graphdemo.JPG for a picture. It would be better to change these dates to times (hours) whe...

Mocking View with RhinoMocks

We are using MVP (Supervising Controller) for ASP.NET WebForms with 3.5 SP1. What is the preferred way to check the value of a view property that only has the a set operation with RhinoMocks? Here is what we have so far: var service = MockRepository.GenerateStub<IFooService>(); // stub some data for the method used in OnLoad in the pr...

How to read image metadata when source is http

I have no problem getting to the metadata is the file is local, but if my reference is a more general http uri -- that's the problem. Here is my test code: String s = "http://myserver/MediaStore/pic1.jpg"; //String s = "c:\\MediaStore\\pic1.jpg"; <==== This works Uri u = new Uri(s, UriKind.RelativeOrAbsolute); ...

Why is the SortedList(TKey,TValue).Keys property an IList(TKey) rather than a ReadOnlyCollection(TKey)?

The IList<T> interface includes access by index in addition to operations not supported by the SortedList<TKey, TValue>.Keys property such as Add, Remove, and Insert. A ReadOnlyCollection<T>, such as the return value of List<T>.AsReadOnly, implements IList<T> and therefore offers access by index but hides illegal operations like Add, et...

Reading file content changes in .NET

In Linux, a lot of IPC is done by appending to a file in 1 process and reading the new content from another process. I want to do the above in Windows/.NET (Too messy to use normal IPC such as pipes). I'm appending to a file from a Python process, and I want to read the changes and ONLY the changes each time FileSystemWatcher reports an...

why would GetValues take an object array as input rather than return a new array

The SqlDataReader class offers a method called GetValues. What I find curious about this method is that it takes an object[] as input and returns an int of the number of values copied into the array. Any idea why the method was designed that way, rather than returning a new Array? ...