.net

How to control which validators are used in a DataGrid

I'm developing a web page in Asp.Net 1.1 and have a DataGrid which allows users to add, edit, and delete database records. The footer row contains textboxes to allow the adding of new records. For each column I've defined <ItemTemplate>, <EditItemTemplate> and <FooterItemTemplate> elements. The FooterItemTemplate and EditItemTemplate e...

Entity Framework Error on Model Creation

I am a newbie to the Entity Framework. I am trying to generate a model from my database and I get the following errors: '_Content' is already declared as 'Private _Content As Integer' in this class. 'OnContentChanging' cannot be declared 'Partial' because only one method 'OnContentChanging' can be marked 'Partial'. 'OnContentChanged'...

Populate a form and print out document

I have a word document which is a blank form. I need to be able to fill it in programatically using .NET, and print out the result. The form I have is a word document but I could obviously convert this to pdf if need be. Can anyone please help? Thanks Ronnie ...

.Net Deployment Project's Detected Dependencies magically un-excluded

I have a Visual Studio 2005 .NET solution that has 20+ sub projects including a deployment project. The VS2005 .NET deployment project has a number of detected dependences, that have been manually excluded and corrected values manually added in. Sometimes however, these detected dependencies get magically un-excluded, which triggers a ...

How do I include the .NET Compact Framework as part of a Smart Device CAB Project?

I'm working on a VS2008 Smart Device app that includes a Smart Device CAB Project for deployment. I was surprised to find out that this installer project doesn't install the .NET Compact Framework if necessary. Can it be made to do so? ...

Character Alignment with an OwnerDraw ListView in C#

I'm trying to implement a .NET control that functions like the Firefox Awesome Bar. To that end, I'm trying to bold and underline searched for characters inside of search results displayed in a ListView. I've set up OwnerDraw and I'm using Graphics.MeasureCharacterRanges to figure out how big the characters are. The problem I'm having...

Why does my .net application require full trust?

I've developed a .net 3.0 application, which is deployed using clickonce. I'd like to move from full trust to partial trust to ease deployment. I've tried the "Calculate Permissions" tool in the "Security" tab of my project under visual studio, and the answer is quite clear : --------------------------- Microsoft Visual Studio -------...

Why can't I define a ResourceDictionary in XAML and instantiate it by itself?

Ok, that question was really hard to ask in one line. Here's the deal. If I have this XAML: <ResourceDictionary x:Class="MyAssembly.MiscResources" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <SolidColorBrush x:Key="MyBrush" Color="Purple" ...

How create role to put in the database???

Hi all, i wish create a role for each user after that the user authenticate(login) to access to the application i will give some role to and save the role on the database. I will make an example with the database "aspnet.mdf" and Linq toSql to store data but before i need know how create role in c#(WPF) and after created i wish add ro...

Strongly typed dynamic Linq sorting

I'm trying to build some code for dynamically sorting a Linq IQueryable<>. The obvious way is here, which sorts a list using a string for the field name http://dvanderboom.wordpress.com/2008/12/19/dynamically-composing-linq-orderby-clauses/ However I want one change - compile time checking of field names, and the ability to use refacto...

Will calling a File.Exist put a lock on a file?

Hi, If I am trying to delete a file, but at the same time another process is performing a File.Exists(...) on the same file, will that potentially lock the file and cause my process to fail? ...

Why does Enterprise Library throw intermittent "Data connection failed to open" errors?

...

Shuffle using IComparer

First of all, I do know about the Fisher-Yates shuffle. But lets say for arguments sake that I want to allow the user to pick a sort option from a Dropdown list. This list would include a "Random" option. Based on the result of their selection I just want to substitute in an IComparer instance for my sort. What would the IComparer lo...

Can I create this type of Graph in ZedGraph?

Let's say I have a sine curve in ZedGraph that goes from -10 to +10 on the y-axis. I'd like to be able to put limits on the curve (let's say minimum of -5, and maximum of +7), such that anything below -5 and anything above +7 is shaded, and everything in the middle is not. Is this possible in ZedGraph? Is this possible in any OpenSource ...

Easiest to learn and use .NET ORM framework?

We are re-writing one of our core web applications and I finally got the all clear from management to replace the horrible tangle of stored procedures with an ORM framework for implementing our data access layer. Hooray for me. Now I have to choose one. I have played around a little bit with the following NHibernate Castle ActiveRec...

ASP.net MVC = Classic ASP with .net class library. Really???

This blogpost and one of our senior developers at work believe that web development has come full circle with ASP.net MVC. Its not really a question about VB script vs VB9/10 or whatever is the latest. Besides routing engine, helper classes and methods. What are some strong arguments you can make to say ASP.net MVC != Classic ASP + ...

Which versions of .NET Framework I can count on?

I am writing an app to discover what features exist on a pc. The user would go to a web page, download the app and execute it (with all the appropriate warnings, this is not spyware). The app would use the standard MS api to determine such things as connection speed, installed memory, firewall health, etc. Writing the app is not a proble...

Best practices for DataBinding in asp.net for maintainability

Hi, I would like to know what are the best practices for using asp.net DataBinding, in terms of maintainability. I don't want the application to fall appart when I have to make changes to the database. Should I databind completely in codebehind ? I am planning on using ObjectDataSources for the databinding. Is there something that is ...

Is it bad practice for an object to catch its own exception and store the message in a property?

Let's say I have a list of objects of the same type. I want to iterate over that list of objects and execute a "dangerous" method on each of them. If an exception occurs in that method, is it bad practice to have the method itself catch the exception and set an error property on the object? Here's a quick example where the Start() m...

Best way to pass a connection object among forms?

Background: I'm rewriting a VB6 app that used MS Access for data storage to one that uses VB.NET and MS SQL Server. I'm curious as to the best way to pass a connection among the different forms in my application that need a connection to the database. Right now I've built a class to manage the connection string to pass that between f...