.net

LinqToSql declare and instantiate DataContext best practice?

What's the best practice in terms of setting up my DataContext for easy access in my extended LinqToSql classes? For example, I have a "User" entity in my dbml and I want to add methods to that class like so: Partial Public Class User Public Function GetUser(ByVal UserID as Integer) as User 'Do Work End Function End...

.NET open PDF in winform without external dependencies

Is there a FREE library which will allow me to open a pdf and show it on a winform project. I know I could open it in adobe reader or something but it always seems so bloated to me and I would be relying on it being installed. Is there a nice lightweight alternative where I could just include a dll in my project or similar avoiding exter...

Using Ribbon as tab control

I would like to create application with ribbon interface that looks and behaves like this: application have one main form with ribbon ribbon has multiple tabs when user switches tab on ribbon, panel below ribbon changes and displays content related to ribbon panel. That way, ribbon tab acts as if it is tab over whole window. For exa...

LINQ joins and ADO.NET Data Services

I have a Windows Service which exposes three sources of data via ADO.NET Data Services. These sources of data are read only XML files loaded into an XDocument and then exposed via .AsQueryable(); The sources contain fields with integer IDs which can be considered to be 'foreign keys' between the data sources. My client consumes this dat...

Alternative to MS-Access/Excel for Spreadsheet Manipulation

I have an MS-Access application that formats the data in two large spreadsheets (20,000+ rows), imports this data into tables, runs a few queries comparing the data and outputs the results as excel files. The problem is that as the application (and VBA code) grows it's becoming more of a pain using Access and I'm wondering if there is ...

How do you turn off or replace the default ModelState error message in Asp.net MVC?

I have a controller action which has a nullable DateTime as one of the parameters which comes from a textbox on my form. I noticed that if the user were to type in "blah" in that textbox then I will get a Null value back for the DateTime param and a model error is automatically added. In this case the ModelState error that is added is "T...

HTML text not formatting

so I have HTML formatted Sql text stored in my database, I populate the contents of a <p></p> tag with it on page load, but though HTML tags are showing up in the text they are not formatting the text. Is there a step I am missing? ...

What are some resources I can use to learn profiling/optimizing?

I just inherited a C# project that runs way to slow and will have to start optimizing it. What I wanted to do first is learn a little more about profiling/optimizing since I didnt have to do it before. So the question is where do I start, what books/blogs/articels can i read? I do know OF the .net profilers like ANTS profiler and so on,...

string webPath = folderPath.Replace("\\", "/");

string webPath = folderPath.Replace("\", "/"); Hi, I'm trying to replace the above but struggling. Will I need an apply an escape sequence to /. If so anyone know what it is in c#. Any help/hints much appreciated. ...

Which express edition to use for ASP.NET web apps in C#?

Which Express edition is best suitable for starting ASP.NET web applications in C#? I imagine Visual Web Developer Express is designed for this, but what about Visual C# Express? ...

Compile all C# files into one file?

Is there a way to compile C# files into one single file that is ready to give to the user? ...

How can i debug this line of code in Visual Studio?

Hi folks, i have the following line of code in VS2008. VirtualPathData virtualPathData = RouteTable.Routes.GetVirtualPath(_viewContext.RequestContext, "Home", pageLinkValueDictionary); I wish to debug this GetVirtualpath(..) method .. to see what it's trying to do. I'm assuming i need to grab the symbol...

What's the name of the control that has buttons for auto-hidden windows like the one used in Visual Studio 2005/2008? (.Net)

In Visual Studio when you click the Auto-hide thumbtack looking icon the window will collapse into a band that has buttons for each hidden window for the docking area. I've seen this in other apps so I assume its a control that I haven't found or figured out how to use yet. ...

Appropriate VS Project for Multiple .Net Sites

Here's what I'm working with: Several websites Classes/data shared between them (registration systems on individual sites, and management on a central site) A workflow application that runs nightly. I need to be able to cleanly and easily share the classes between the websites and workflow component. I know this is textbook 'DLL!', ...

Checking for null before ToString()

Here's the scenario... if (entry.Properties["something"].Value != null) attribs.something = entry.Properties["something"].Value.ToString(); While effective and working correctly, this looks ugly to me. If I don't check for a null before performing the ToString() then it throws an exception if the property was null. Is there a be...

Oracle client x32 and x64 coexistence

My client have an x64 server where he installed both x32 and x64 versions of Oracle Client. After he installed my web application and tried to run it he got "An attempt was made to load the program with an incorrect format (HRESULT 0x8007000B)" exception about Oracle.DataAccess.dll His IIS configured to 64 bit. I event asked him to ad...

Lock free stack and queue in C#

Does anyone know if there are any lock-free container libraries available for .NET ? Preferably something that is proven to work and faster than the Synchronized wrappers we have in .NET. I have found some articles on the .NET, but none of them specify any speed benchmarking, nor do they inspire much confidence in their reliability. T...

Username and Role

Hi , i have this Database table(UserID,Name,Surname,Username,Password,Email) and table(RoleID,RoleName,Description) and table(UserID,RoleID )so i create a Login Authentication with username and password to access to the application (with Linq ToSql to store data) and it is right . Now i wish create a role for each user but i don't kno...

detecting asp.net redirecting users to login page

i have a directory in my website that is protected from anonymous users. my web.config looks like this <location path="members"> <system.web> <authorization> <allow roles="members" /> <deny users="*" /> </authorization> </system.web> </location> if anonymous users try to access pages in the "/members" directory they will b...

At what point does using a StringBuilder become insignificant or an overhead?

Recently I have found myself using StringBuilder for all string concatenations, big and small, however in a recent performance test I swapped out a colleague's stringOut = string1 + "." string2 style concatenation (being used in a 10000x + loop with the StringBuilder being newed each time) for a StringBuilder just to see what difference ...