.net

Subsonic 3 - SimpleRepository

Hi guys, I am playing around with Subsonic 3's simple repository and am hitting walls in understanding how to deal with foreign keys... If I have a product object containing int ID; string name; string description; Category category; int categoryID (this one is just to persist the product's categoryID to the DB) and a categor...

determine the user on SharePoint

How can I know the user logging onto SharePoint through code? I am using WebPart inside it SmartPart and inside it a User control. ...

printing a form

can i have a button in my form which shows the print dialog box so that the user can print that form ?? i m new in prog so pl help if there can be such commands to perform the action.. ...

ListView onScroll event

Hi, I’m programming one easy C# application, and i need onScroll event on Listview. So i created class ListviewEx witch inherits original ListView. I found how to detect scroll message from WinAPI and i modified WndProc method. Now i have this WndProc: protected override void WndProc(ref Message m) { base.WndProc(ref m); i...

Duplicate LINQ to SQL entity / record - with associated records?

I'm using Linq from ASP.NET (C#); and I'm trying to add a 'clone record' function. This question - allows copying of a single record from a single table; how can I expand it to include associated records in tables linked through foreign keys? ...

How can I find the Harddisk Device Serial Number without using the WMI in .NET?

I want to get the hardwired serial number from the hard disk but NOT using WMI. I tried using WMI code, and it doesn't work on my machine for sure. So is there any alternative in .NET for finding the Serial Number of a physical hard disk? ...

Good books on the coming .net framework 4.0

Any recommendations on good books to read about the coming .NET framework? Books that cover new features of the framework and new language syntax for C#. Thanks. ...

getting a header/filesize .NET

I have a link to two files, they may be the same file but they may not be the same URL. I want to figure out if they are the same by checking the content-length before doing a full download. Whats the best way to do this? Currently i am using webbrowser control to load the page and extract data then using WebClient.Download to get the fi...

Can't run WPF app

I have Visual Basic Express 2008 and .net framework 3.5 on xp sp2. I create a new wpf application, when I try run the application I get the following error. " 'Error while trying to run project: Unable to start program 'C:\Documents and Settings\Mike\My Documents\Visual Studio 2008\Projects\WPF\bin\Debug\HelloWorld.exe' Access Denied"...

ASP.net Export image to Excel

Hi there, How could we Export an image to Excel on top of a gridview, using Respone.Write Thanks in advance ...

DotNetOpenId — Getting replay attack failure with programmatic and web logins

I'm adding optional OpenID authentication to the system. Everything works smoothly with DotNETOpenID. Yet, I get an issue when: User logs into the web application using a standard login (FormsAutentication) User associates some OpenID with the account (we use programmatic OpenID logon here to get the claimed identity) User logs out of ...

Handling Type.InvokeMember Inner Exceptions nicely

I have a bit of code which is calling the InvokeMember method on a Type. This is fine and works however if an exception occurs within the member being invoked then the debug jumps to where I am calling InvokeMember as opposed to the inner exception. Is it possible to get around this so that the code debugs as expected? ...

SQL delete operations not rolled back

When I rollback a transaction it rollbacked only update and insert operations, but delete operations are not rollbacked, I want to know the reason? I am using insert, update and delete operations under one SQL transaction ...

Isn't a generic IList assignable from a generic List?

bool IsTypeAGenericList(Type listType) { typeof(IList<>).IsAssignableFrom(listType.GetGenericTypeDefinition()) } returns false when given typeof(List<int>). I assume this is because the two type parameters can be different, correct? ...

Pass an object into a UserControl in a repeater? .Net 1

I want to wrap up a chunk of HTML render logic in a User Control. Then I want to pass a custom product object (title, thumbnail, id, etc.) to the UserControl that it can use when it renders. Ideally I want to use this in a repeater (or for loop) and pass the current custom product object into the UC. Every example I've seen has been pas...

Code Signing Certificate for open-source projects?

(Project created in C# with visual studio 2008. Plus additional project in ASP.NET that wants SSL.) I want to publish one of my applications as open-source and want to digitally sign the binaries I've created with my own certificate. (Of course, anyone else can just download the code and build it themselves with their own certificate.) ...

DataContractSerializer, KnownType and inheritance

I've read many articles about known types and i belive my example should work. But it doesn't. I'm getting the following exception on deserialization and don't understand why: Error in line 1 position 2. Expecting element 'A' from namespace 'http://schemas.datacontract.org/2004/07/ConsoleApplication2'.. Encountered 'Element' with name ...

What is the fastest way to create a checksum for large files in C#

Hi, I have to sync large files across some machines. The files can be up to 6GB in size. The sync will be done manually every few weeks. I cant take the filename into consideration because they can change anytime. My plan is to create checksums on the destination PC and on the source PC and than copy all files with a checksum, which ar...

How should I document an existing system

Hi there, I've just started at a new job with sole responsibility for a large(ish) financial application. It's got about 800 stored procedures, 120 SQL server tables and 18 .net projects with approx 1200 code files. And no documentation other than line comments in the code. As I mend bugs and make ad hoc to the data I want to document w...

Strip double quotes from a string in .NET

I'm trying to match on some inconsistently formatted HTML and need to strip out some double quotes. Current: <input type="hidden"> The Goal: <input type=hidden> This is wrong because I'm not escaping it properly: s = s.Replace(""",""); This is wrong because there is not blank character character (to my knowledge): s = s.Rep...