.net

Good alternative to .net DateTimePicker?

I can't really explain why exactly, but I really hate the .net DateTimePicker control built into C#.net and VB.net. Is anyone aware of a good alternative to either of these controls which is freely available? I'm sure I'm not the only one who doesn't like the control. The date picker in Google Calendar is one which I really like, so I...

How can I handle an empty namespace with XDocument.XPathEvaluate?

I'm trying to use XDocument and XPathEvaluate to get values from the woot.com feed. I'm handling other namespaces fine, but this example is giving me problems. <rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0"> <channel> <category text="Comedy" xmlns="http://www.itunes.com/dtds/podcast-1.0.dtd"&gt; </cate...

In .NET, How can I draw shapes on a picture ?

I'm doing a software where I need to put squary bordering fields on a satelite map (.png image), so that the fields can be clicked. What is the best way to add shapes on a picture and associate them with data ? ...

how do I access the textbox in a column when I click "Add new record" in the telerik radgrid

I have a grid that has the "Add new record" button clicked showing the textbox with Role: [TextBox] and the checkbox and cancel buttons below it. The grid has only one columncalled RoleName with a title of Role as shown below. When I click the checkbox button, I am firing the InsertCommand that uses an objectdatasource with three par...

Design pattern for loading multiple message types

As I was looking through SO I came across a question about handling multiple message types. My concern is - how do I load such a message in a neat way? I decided to have a separate class with a method which loads one message each time it's invoked. This method should create a new instance of a concrete message type (say AlphaMessage, Bet...

DateTimeFormatInfo string format for day of week. Thursday becomes Th.

Is there a DateTimeFormatInfo format pattern to convert a day of week to two characters? For example Tuesday becomes Tu, Wednesday becomes We. The format string needs to conform to the DateTimeFormatInfo for date formats. Addition: Maybe I am looking for a solution to extend DateTimeFormatInfo to include custom formats? ...

MEF import problem with CreationPolicy

below is the demo of my problem, I'd like to create many child which have a reference to their parent. How to write the import attribute to get the parent reference instead of create a new parent instance? public partial class MainPage : UserControl { [Import(typeof(Parent))] public Parent Parent1 { get; set; } [Import(ty...

Which user needs access to SQL Server 2008 R2 db using IIS7.5 and .NET 4.0?

I am running a .NET 4.0 WCF service that attempts to access a SQL Server 2008 R2 database. System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: Login failed for user 'IIS APPPOOL\ASP.NET v4.0'. In previous versions of SQL Server, I would make the [computerName]\IUSR_[...

How to pass associative Array parameter from javascript to ActiveX object?

I'd like to pass an associative array (or simply an object with property names & values) to my ActiveXObject. I can't find anyone who has successfully and simply passed complex data from javascript to an ActiveX object. My ActiveX object is being loaded in IE, and it's mine so I can change the method signature & code to whatever will w...

When constructing a Bitmap with Image.FromHbitmap(), how soon can the original bitmap handle be deleted?

From the documentation of Image.FromHbitmap() at http://msdn.microsoft.com/en-us/library/k061we7x%28VS.80%29.aspx : The FromHbitmap method makes a copy of the GDI bitmap; so you can release the incoming GDI bitmap using the GDIDeleteObject method immediately after creating the new Image. This pretty explicitly states that the bitm...

How to get the value from an object from args.getDataKeyValue

Now suppose CompanyName is a object and I want to get one field's value from args.getDataKeyValue("CompanyName"). Is this doable? function RowSelected(sender, args) { document.getElementById("<%= Label1.ClientID %>").innerHTML = "<b>CustomerID: </b>" + args.getDataKeyValue("CustomerID") + ...

Ways to determine size of complex object in .NET?

Are there ways at determining the total size of a complex object in .NET? This object is composed of other objects and might hold references to other complex objects. Some of the objects encapsulated by this object might be POD, others may not. ...

HttpWebRequest.UserAgent : What does it do

I read this MSDN like about it and ran its example. http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.useragent.aspx when I change the uSerAgnet to something like "blah", the output is wrong but when I use the same thing that is in the example of even when I comment out the line of code that is setting the UserASgent, th...

Get window z index from window handle

If I have a window handle, is there a win32 call or .net equilavent that will tell me what the z index is? ...

Binding a ListBox's SelectedItem in the presence of BindingNavigator

Hello. I'm trying to bind a ListBox's SelectedItem data to a property. The following code is an example: using System; using System.Collections.Generic; using System.Windows.Forms; namespace BindingFailure { static class Program { class OuterObject { public string selected { get; set; } public List<string> strings { get; se...

Is there a difference SMO ServerConnection transaction methods versus using the SqlConnectionObject property?

I am using SMO to create databases and tables on a SQL Server. I want to do so in a transaction. Are both of these methods of doing so valid and equivalent: First method: Server server; //... server.ConnectionContext.BeginTransaction(); //... server.ConnectionContext.CommitTransaction(); Second method: Server server; // ... SqlCon...

Retrieving webmethod parameter values from Application_BeginRequest or Application_EndRequest

Is there a way to retrieving parameter names and values passed to a web method from Request object? I've read somewhere that you need extra code to access the soap body. Any known workarounds to be able to see the soap body from Application_BeginRequest? Thanks! ...

SharePoint authentication via a proxy server

A client has trouble logging into our webpart (SP 2007). Apparently, his internet connection is via a proxy server. He has no problem logging in to our main website. Authentication from both the webpart and the website is through the same API. Any suggestions? Thanks. ...

How to build a Windows Forms email-aware text box?

Hi, I'm building a C# client app that allows a user to communicate with one or more existing users in a system via an email-like metaphor. I'd like to present the user with a text entry box that auto-completes on known email addresses, and allows multiple delimiter-separated addresses to be entered. Ideally, I'd also like the email addr...

How should a unit test be written to verify a WCF-RIA Services DomainService query method requires authentication?

I'm doing unit testing for our WCF RIA services, which have RequiresRole or RequiresAuthentication attributes attached to them. I've been able to test the Update, Insert, and Delete methods to ensure the attributes are properly set. This is done by mocking a IServiceProvider, creating a DomainServiceContext with that provider and the cor...