.net

How to get the selected value of a asp.net mvc Html.radiobuttonfor

I've two radio buttons, <%= Html.RadioButtonFor(m =>m.Type,true,new {id = "rdPageType",CHECKED = "checked" }) %> <%= Html.RadioButtonFor(m =>m.Type,true,new {id = "rdPageType12",CHECKED = "checked" }) %> How can I check which is selected, when the 1st is selected, I should be able to set the boolean value of 'rdPageType' to true, and ...

What is the best strategy to support .NET 3.0 and .NET 4.0?

I would like to support .NET 3.0 and .NET 4.0 for my project. My current solution is to have two project files - one for each version of .NET. Is there a better / more convenient way? ...

.Net DateTime.Subtract Issue

I have a function that returns the difference between 2 DateTime's in seconds. However, in certain cases its not working correctly and I'm not sure why. I.E.: Debug.WriteLine(DateTime.Parse("7/22/2010 9:52:39 AM").Subtract(DateTime.Parse("7/22/2010 8:58:38 AM")).Seconds, "WTF"); The above code returns 1 ... obviously there's more tha...

Understanding the MVC Pattern

I am having some trouble understanding the MVC Pattern. I do understand we are trying to decouple the GUI from the business logic, although I'm having problems understanding how. From what I understood, the View, is what the user sees. So it generally is the window/form. The Controller is inbetween the View and the Model. The Controller...

Will Dispose() cause a release of resources ahead of time in this case?

I have this class: class Foo : IDisposable { SomeBigResource resource; void UsingResource() { using(Bar bar = new Bar(SomeBigResource) bar.doStuff(); } void Dispose() { resource.Dispose(); } } void Function() { using (Foo foo = new Foo(new SomeBigResource)) foo.UsingResource(); } The Bar object h...

Why is marking an assembly ComVisible(true) discouraged?

I have always marked my .NET assemblies as visible to COM with [assembly: ComVisible(true)], thinking that I never know when someone might need to call them from COM. I also started using FxCop and started seeing this warning from code analysis: CA1017 : Microsoft.Design : Because 'MyLibrary.dll' exposes externally visible types, ma...

Communicate between windows form and console.

Just wondering if anyone has an example of communicating from console app to windows form or vice versa. Thanks ...

Update a TextBlock with elapsed time causing an UnauthorizedAccessException

I have a very simple StopWatch application in Silverlight. I have the following private properties in my MainPage class: _StopPressed (bool), _TimeStart, _Elapsed (string). I also have a "Start" and "Stop" button. The "Start" button calls a method called UpdateTime that constantly updates _ElapsedTime until _StopPressed is true. Wh...

Show window in Application_Startup. Wpf.

I have this small piece of code. private void Application_Startup(object sender, StartupEventArgs e) { WndAbout ab = new WndAbout(); ab.Show(); } And want to show window or dialog at application startup, before other modules will be loaded. But! When I close the showed window, the main window, ...

Difference between Open and Create on DocumentFormat.OpenXml.Packaging.WordprocessingDocument

The docs for both methods read virtually identical to me. I have a template (.DOTX) which I want to open and make changes to, saving as .DOCX. What's the right approach? And, in fact, how do I save the document? I see no Save method... ...

WCF Error Architecture

I am looking at implementing a Web Service API for our product. I have figured out how you go about the general architecture/fault handling within WCF. My question is a more general one of how to design the overall error handling system. For example I have a method called SaveCompany(companyobject). Each company name needs to be uniq...

TemplatingEngine Design Question

I am working on a component for merging arbitrary tokens with text in order to generate e-mails. I am going to be using nvelocity for the merging process, so I have defined the following interface: public interface ITemplateEngine { string Merge(string template, IDictionary<string, object> data); } Now, in my scenario, the impleme...

Is there a way to detect an "almost" Remote Desktop disconnect (i.e., a brief period of high latency)?

I work for a trading company where our users interact with the primary trading application via a Remote Desktop connection to a server that's physically located within the exchange's facilities. A feature of our software is that it disconnects and pulls all quotes automatically if something goes wrong with the network and the RD session...

.NET Tiff Issues C#

I'm having issues with TIFFs Here is what I have to do, we have tiff images saved into the database, these images are CCITT4 compressed with a number of required tags, these include: RowsPerStrip must be the ImageLength Photometric Interpreation must be MinIsWhite Multi-strip image format is not allowed My problem is, I'm using the ...

how to remotely install certificate on Windows CE using RAPI and ActiveSync

I'm creating .NET application which connects to WindowsCE device using Active Sync. I'm using OpenNETCF.Desktop.Communication.dll library to connect via RAPI but I didn't find any way to install the certificate on the mobile device. ...

asp repeater databound

I guys, isn't present databound event on asp repeater server control? I just want to bind all my data, and at the end creates a new ItemTemplate and add it, but just when is all data binded ...

telerik radgrid - how do I set the page focus to the insert button after clicking the add new record button to add a record

I have a telerik radgrid that has an allows inserts. After clicking the "Add New Record" button the textboxes appear with a couple of buttons. One for Insert and one to cancel. I would like the page focus to be on the insert button so when the user clicks the enter button, the insert button has the focus. Does anyone know how to do t...

Retrieving a list of hyperlinks/bookmarks from an XPS Document?

I have a .docx file with a bunch of bookmarks and hyperlinks. I can navigate through these in documentviewer just fine. What I would like is if it was possible to generate a list of all of the hyperlinks contained in the file. From there, I can create a TreeView on the documentviewer and call the links by name (using the list) instead of...

anyone who has used Atlassian's Elastic Bamboo to build .NET projects - what AMI do I need to use?

This whole setup process is fairly perplexing, and I feel like the documentation is written for CI and cloud experts. Can anybody lend some inght into their setup? ...

Need C#/C++ DLL Advice

I have successfully gotten Dreamweaver to accept my DLL and call it's methods. The DLL is written in C++ with C interpeted functions (so function names aren't mangled.) I would like to become comfortable with C++ pointers and datatype, but I have a much stronger proficiency with C# so for our timeline I think it's worthwhile to investig...