.net-2.0

Howto force Report Viewer to be shown in print preview mode

In Visual Studio 2005, how can I show a report in ReportViewer control directly on Print-preview mode? ...

How to load Font from file on a RDLC report?

In Visual Studio 2005, how can I load a font from a file and use it on a RDLC report? I know how to load a font from a file thanks to this question, but i'm not able to use it in a RDLC report. ...

C# - Store and then update a property

Evening all, I've written a transfer application that needs to perform an update, then update a date corresponding to that update. I.e. string content = string.Empty; IIvdManager manager; DateTime configDate; if (table == Tables.Asset) { content = WebService.GetTblAsset(companyId); manager = ivdData.Instance.Asset; configD...

Upcasting to a generic object from system.object

Hello! I have some simple code which demonstrates my problem: private void InitializeOther() { List<Foo> list = new List<Foo>(); Casting(list); } //in the "real" case I have no knowledge of o, other than it could be a List<> private void Casting(object o) { Type t = o.GetType(); while (t.BaseType != typeof(Object)) { if ...

How can I load a panel at click-time with a ModalPopupExtender?

I am creating a checklist, where "checklistitems" are added to a "checklist". Each of the items has a button next to it to launch a modal popup that will contain additional information about the item. Because there are so many items, I've put the actual panel that will pop up on the "checklist", so it will only be on the web page once....

How to make a search usercontrol generic in .net2.0 winforms

I have a search usercontrol that I'd like to make generic. The control itself will contain a different collection of controls dependent on its context. For example it could be stock items, people, address as the context of the search.. How can I make it generic enough that based upon the search context it knows exactly what user contro...

Get unqualified host name in .NET

Is there a .NET equivalent to the winsock function GetNameInfoW() with the NI_NOFQDN flag set? As the MSDN docs for GetNameInfoW explain: Setting the NI_NOFQDN flag results in local hosts having only their Relative Distinguished Name (RDN) returned in the pNodeBuffer parameter. The closest thing I can find is System.Net.Dns.GetHost...

How we run .NET 32bit Application in a 64bit Windows Server?

We are installing a third party application in one of our 64bit windows servers. This application apparently was build with the compiler option set to choose the platform at run time. When we run the application it gives us a System.BadImageFormatException: is not a valid Win32 application. Errrors. I have seen in forums from the ...

Reverse a ResourceManager

If you do ResourceManager.GetString(Key), you can get the value of an item in a resource. Is there a way to do a reverse lookup to get the key from the resource given the value (essentially de-translate)? ...

Best way to search data in xml files?

In our new project we have to provide a search functionality to retrieve data from hundreds of xml files. I have a brief of our current plan below, I would like to know your suggestions/improvements on this. These xml files contain personal information, and the search is based on 10 elements in it for example last name, first name, emai...

URL rewriting

I am using regx for URL rewriting. created a XML file and write the below code in Global.ASAX file string sPath = Context.Request.Path; Context.Items["VirtualURL"] = sPath; Regex oReg; System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); xmlDoc.Load(Server.MapPath("~/Rule.xml")); System.Xml.XmlElement _oRu...

Comparing program flow between same app in .net 1.1 and .net 2.0

I'm looking at upgrading an application we're developing here using Visual Studio 2003 / .NET 1.1 to Visual Studio 2008 / .NET 2.0. Now I was testing stuff, and found that I have a reproducable case in which the .NET 1.1 version does what it is supposed to do, while the .NET 2.0 version (same code) ends up in an infinite recursion (the ...

Logging for ASP.NET - Best Practices

What is the best way to write minimal error logs in an ASP.NET 2.0 web page or web service? For my purposes it'd be best if this was vanilla, and the implementation would work through IIS's virtual directories. I'm currently using the standard TextWriterTraceListener, but it doesn't seem to write to the virtual directory. FYI - the Te...

Expose webservice information to SCOM / WMI

What would be the best way to expose information from an ASP.NET webservice to SCOM or WMI? I'm interested in basically exposing performance information so the service can be monitored: ie. get a metric of calls processed per hour, total calls per day, etc. EDIT: This would have to run under standard ASP.NET permissions ...

Dynamically Filter data in a DataGrid

I have a ComboBox with the values "open", "closed". According to values changed in the ComboBox, I want to change the DataGrid to display either "open " or "closed" values. How can I do this? ...

Does Windows Installer use Assembly Version or File Version to update dlls

I have a .net (2.0) winforms application that I need to upgrade on client machines. At the moment this is done by incrementing the Assembly Version and File Version on all of the projects and incrementing the version on the Installer project in VS2008. The application now makes use of Isolated Storage to save some user settings in an XM...

Form's lost focus in C#

This may be a simple C# question but I need a solution thou' I have two forms, form1 and form2, with form1 having a button. On the click of the button, I wanna show form2. But when this form2 looses foucs I wanna hide it (form2). How do I do it ?? I tried to subscribe to LostFocus event of form2, but it isn't working. Please help me w...

Mimicking the UltraGridColumnChooser's drag & drop ability

(Infragistics 2008 Vol. 3, CLR 2.0) Infragistics's UltraGrid comes with a column chooser user control, which is simply a vertical arrangement of columns with checkboxes that toggle a column's hidden state. In addition, it allows you to pick a column and drag it directly to the grid so you don't have to manually position it afterwards. (...

Watermark System.Windows.Forms.TextBox using C#

What is he best way to implement Watermark functionality for a System.Windows.Forms.TextBox in .Net 2.0 with C#? Edit: Using the ready-made component from CodeProject was very easy. It's also with a The Code Project Open License (CPOL). ...

Alternative to SQL BULK INSERT

I need to import the data form .csv file into the database table (MS SQL Server 2005). SQL BULK INSERT seems like a good option, but the problem is that my DB server is not on the same box as my WEB server. This question describes the same issue, however i don't have any control over my DB server, and can't share any folders on it. I ne...