.net

Why asp:HyperLink.NagigateUrl in user control, placed in sub-folder, contains this sub-folder?

~/Folder1/UserControl1.ascx: <%@ Control Language="C#" CodeBehind="WebUserControl1.ascx.cs" Inherits="WebApplication1.WebUserControl1" %> <asp:HyperLink runat="server" NavigateUrl="?foo=bar">HyperLink1</asp:HyperLink> ~/UserControl2.ascx: <%@ Control Language="C#"CodeBehind="WebUserControl2.ascx.cs" Inherits="WebApplication1.WebUserC...

Entity Framework: Load all references?

I have lots of other referenced entities in one of my entity objects. Is there a quick way just to say "if there's something not loaded in here, go ahead and load it" without doing them each individually? ...

Filtering IEnumerable Pattern

Consider the followign simple code pattern: foreach(Item item in itemList) { if(item.Foo) { DoStuff(item); } } If I want to parallelize it using Parallel Extensions(PE) I might simply replace the for loop construct as follows: Parallel.ForEach(itemList, delegate(Item item) { if(item.Foo) { DoStuff(item); ...

Telerik Rad Textboxes and javascript issue

I am simply trying to fill a Rad Text box with server data in javascript. The data is placed inside of the textbox but it is not visible until i click on the Rad Textbox. function pickItem(name, sku, plu, nameBox, sBox, pBox) { sBox.value = sku; pBox.value = plu; nameBox.value = name; ...

.NET app locks file

Okay I;m really new to VB.NET and desktop application development. Simplified this is what is happening in my application: Dim Files() As New List(Of IO.FileInfo) Files.Add( (New IO.FileInfo("C:\img1.jpg")) ) Files.Add( (New IO.FileInfo("C:\img2.jpg")) ) 'Picture is a Windows.Forms.PictureBox in my WinForm ' Picture.Image = New System....

.net Oracle Data Provider transaction rollback not working

So this is the problem. I need to insert into tableA and get its new row id. After that, I must insert that id into tableB. I must commit after the insert into tableA so that when I attempt to insert into tableB I won't get a foreign key exception. Now, my understanding was that if an exception was raised in the function that inserts...

Convert String to Date in .NET

What is the best way to convert string to date in C# if my incoming date format is in YYYYMMDD Ex: 20001106 ...

Is there a way to avoid the XmlSerializer to not initialize a null property when deserializing?

I have this class: public class MySerializableClass { public List<MyObject> MyList { get; set; } } If MyList is null when MySerializableClass is serialized, I need to have it null when it's deserialised too, but the XmlSerializer always initializes it when it deserialises my class. Is there a way to avoid it initializing null pro...

Entity Framework - Update Model From Database... - no update happens!

I have a table in my DB called CompanyDetails. It has a column called CharacterID varchar(255). I just changed it from a NOT NULL column to a NULL column. I ran the 'Update Model From Database...' command in the model browser as well as in the EDMX file viewer. This is what it created in the designer: /// <summary> /// There are no ...

Performance Counters not being released

All: I am using some custom Performance Counters that I have created. These are multi-instance, with a lifetime of "Process". the problem: When I'm debugging in VS, if I stop the process and then start it again, I get an exception when my code attempts to create my performance counters. The exception indicates that the peformance co...

.NET SoapDocumentMethodAttribute SoapRpcMethodAttribute difference

I have Reference generated from WSDL (JIRA-SOAP API), which will throw an exception at deserialization (http://stackoverflow.com/questions/2188662/jira-soap-createissue-from-c), so my workaround would be to return only XmlNode of the response and parse it myself. However if i change [return:] element of: [System.Web.Services.Protoco...

.NET xsd importer creates unserializable class

I am using the .NET XSD.EXE importer to generate C# classes from a collection of XSD files. When I tried to serialize one of the classes to XML it failed (InvalidOperationException), and when I dug into it I discovered it one of the created classes appears to be wrong. Here is the pertinent XSD code: <xsd:complexType name="SuccessTyp...

In .Net using File.CreateText() also locks file, why?

I was using the CreateText method to create an empty file (as below) in "App1". Then tried to have another application write to that file but it failed b/c it was locked. It was not unlocked until I closed "App1" File.CreateText(path) To fix this I can do this: Dim sw As StreamWriter = File.CreateText(path) sw.Close() Why does ca...

disable mouse wheel on itemscontrol in wpf

I have a usercontrol that has a scrollviewer, then a bunch of child controls like text boxes, radio buttons, and listboxes, etc inside of it. I can use the mouse wheel to scroll the parent scrollviewer until my mouse lands inside a listbox then, the mouse wheel events start going to the listbox. is there any way to have the listbox sen...

IL Opcode Modification

Language: VB.NET 3.5 IL opcodes: 718 ldarg.0 719 callvirt System.Windows.Forms.Button RClient.RClient::get_cmd1() 724 ldarg.0 725 ldfld System.String[] RClient.RClient::ButtonStrings 730 ldc.i4.5 731 ldelem.ref 732 callvirt System.Void System.Windows.Forms.ButtonBase::set_Text(System.Stri...

vb.net file watch returns an incorrect filename.

I am attempting to use the VB.Net FileSystemWatcher class to watch a folder for the creation of Excel files. I do get a response when a .xls file is created in the folder, but am having a problem with the below code: Private Sub AddWatch() Dim watch As New FileSystemWatcher AddHandler watch.Changed, AddressOf FileChange watc...

Is there a Marketplace for finding ASP.Net projects to work on?

I am looking to find some good projects to work on. Is there a good site to find such projects and make decent bucks? ...

What is the collection version of SingleOrDefault for a Dictionary<T>?

Title kind of says it all. I just can't seem to find a DictionaryOrDefault \ ListOrDefault \ CollectionOrDefault option. Is there such a method? If not how do I do this: MyClass myObject = MyDictionary .SingleOrDefault(x => { if (x.Value != null) ...

Linq statement to iterate through a collection and making sure each item is in the correct order?

Hi folks, i'm got a simple IEnumerable<foo> foos; This collection are some results from a db call. I wish to make sure that each item in the list is ordered correctly. The Db either returns the results by ordered by id, lowest to highest. eg. 1, 2, 3, 4,. ... etc. ordered by date created, decrement (most recent, first). Can this be...

Need help for a more beautiful LINQ to SQL query

Following is a T_SQL query for AdventureWorks database: SELECT Name FROM Production.Product WHERE ListPrice >= ANY (SELECT MAX (ListPrice) FROM Production.Product GROUP BY ProductSubcategoryID) I try writing a LINQ query for this: var groupMaxPricesquery2 = from product in dc.Products ...