.net-3.5

Determine transfered data size for a web service call in .NET CF

Hi, I'm developing a .NET CF client application and using web services for data transfer. I'm using SharpZipLib to compress transfered datasets so I know the size of the transfered byte array. I wonder is there an easy way to determine to complete request size (html headerder, soap envelops and the real data) for a single call. I reall...

CheckBoxList with multiple values bound to a single flag enum

I have a FormView (bound to an ObjectDataSource) that contains a CheckBoxList that I'd like to bind to a single property of the underlying object that is an Enum with the FlagsAttribute applied to it. Binding to the SelectedValue property always gives me just the FIRST selected value from the list as the property's value. Anyone know h...

None of my Extension Methods are showing in Code behind

I have a number of extension methods defined in my current project. It is a VB.NET project. I have no problem using these methods inside files that are in the App_Code directory, this is the same place that I defined the methods. However, in my page.aspx.vb code behind page these methods are not showing up. I have tried including the cor...

How can I make an endless progressbar in WinForms?

I don't know how long an action could take and I want to display a progress bar to the user in a dialog box. I've tried using System.Windows.Forms.ProgressBar but it doesn't seem to support it. An example of what I'd want is the progress bar that windows shows you when it's looking for new drivers on the internet. It's just got three or...

Business logic in contructor - C# / Linq to Sql

I'm extending (not sure if it's the right word here) a partial Cart class that got generated in Linq to SQL database model. The business logic is that there can be only one Cart per customer. If a customer doesn't have a cart, it should be created; if a customer has a cart, it should be returned. Here's what I'm doing: public partial...

What's the most efficient way to do these two foreach-loops?

Hi folks, i'm not sure this is the best way to do the following code. I'm not sold on a foreach inside another foreach. Could this be done *better** with Linq? *I understand that better could be either a) more performant b) easier to read / more elegant c) all of the above NOTE: .NET 3.5 solutions accepted :) NOTE2: the two IList's ...

good resource about assert policies in WSE3

Hi where can i find a good resource about assert policies in WSE3 ? ...

How do I make a marquee progress bar in WPF?

In Winforms I could set the ProgressBarStyle of a progress bar to Marqee, and that would have the progress bar incriment on its own without having to be set, for processes where I don't know how long its going to take, and no good way to report back to the UI. I would like to do the same in WPF, but I can't find a way to pull it off sho...

How do I group items in a WPF ListView

I have a ListView that I want to group results into, however the examples I am finding are not working. How can I group my results? I want to group on the Status property in my custom object. This is what I have: <ListView IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" HorizontalContentA...

Save IList<T> or IQueryable<T> to Excel - C#

I'm generating a report via Linq to SQL and displaying it on the website. I need to save the report in MS Excel (or .csv) and email it to user. Any ideas on how to save it as Excel or .csv ? .NET 3.5 / C# EDIT: the Gridview hack works perfect. If you use AJAX on the page, make sure you add a PostBaseTrigger to your Update Panel to...

Linq to SQL .Sum() without group ... into

I have something like this: var itemsInCart = from o in db.OrderLineItems where o.OrderId == currentOrder.OrderId select new { o.OrderLineItemId, ..., ..., o.WishListItem.Price} is there any way to do a itemsCart.Sum() //not sure what to pass into the function to get the sum of o.WishListItem.Pr...

How to get next( previous) Enum Value in C#

I have got an enum which is defined like this: public enum eRat { A = 0, B=3, C=5, D=8 }; So given value eRat.B, I want to get the next one which is eRat.C The solution I see is (without range checking) Array a = Enum.GetValues(typeof(eRat)); int i=0 ; for (i = 0; i < a.GetLength(); i++) { if (a.GetValue(i) == eRat.B) ...

How do I reference configuration information from within multiple class libraries?

I've got a bunch of DLL projects that I'm pulling into my application, each contains their own Settings.settings/app.config. When I compile the app and run for debugging, everything works just fine, but come deployment time I can't get my DLLs to read their own settings files. I've been doing some reading and it has become apparent tha...

SQL Transactions for E-Commerce? (Using .Net 3.5 for app)

I have an application I am working on that will need the use of transactions. I am familiar with how they work, but need some suggestions on a current implementation. Here is the scenario... A user is working on a project in our system. In order to publish the project on our system, they must first pay some fees so the project can be pu...

Session item comes back after being removed.

I remove an item from the session using Session.Remove(), then redirect to another page. If I click back, then reload, the item is suddenly back in the session. Shouldn't Session.Remove() take it out of the session for good? ...

How do I create a server side timed event?

I'm working a a project for a new web app. I'm identifying the key points of functionality, and one thing that I clearly don't know how to approach is as follows: Once per minute the server needs to run a series of calcs on its data, and post new derived summaries. So in essence what I need is a way to run a server side script once p...

C# and .NET 3.5 - How to launch a process using different credentials, with a hidden window, and being able to capture standard output and exit code?

I have a Windows Service developed in C# and .NET 3.5 to perform various administrative tasks throughout our 3 domains. I've got an admin account in each domain that has the necessary rights/permissions for what this service is doing. For all the AD interactions, I can bind to AD using the correct username/password for the domain and al...

How to fix this SocketException

I have a loop that opens a socket, acts on the socket, then closes the socket and restarts. However, on the second iteration I get SocketException, Only one usage of each socket address (protocol/network address/port) is normally permitted. However, the socket should be closed, netstat -a doesn't show that I'm listening on that port or a...

Distributed transactions with WCF

Basic architecture: n physical boxes each hosting the same WCF service, sitting begind a load balancer. Each box hitting a single database infrastructure that does not support transactions - don't ask :( So, in the data access layer of my app I need some method of distributed transactions. What are my options? Note that clients to my...

How to get a specific socket and close it

I want to close a socket so I can reopen one on the same port but I do not have a handle on that socket. How can I get the socket that is listening on localhost:873 to close it? ...