.net-3.5

Prevent or handle time out with XmlReader.Create(uri)

Sometimes I am getting a time out exception when reading an XML via a URL. Is there something I can do to prevent this, or is this a problem with the remote server? Below is my simple code: XmlDocument doc = new XmlDocument(); doc.Load(XmlReader.Create(this.RssUrl)); I cam across a post that says KeepAlive may help, but I do not know ...

Telerik RadGrid's paging section not refreshing

Hello All I have a problem with a telerik RadGrid where the paging section is not refreshing. If, for example, the first search returns 15 records and the second search only 5 records, I see '... page 1 of 2...' in the second search which is incorrect info caused by the paging section of the grid not refreshing. My page count is set to ...

Why is GetVirtualPath failing after upgrading to .NET 4

I have the following route defined: var route = new Route("{id}/{a}/{b}", new MvcRouteHandler()); route.Defaults = new RouteValueDictionary(new { controller = "Home", action = "Show" }); route.Defaults.Add("a", ""); route.Defaults.Add("b", ""); And the following controller code: public ActionResult Show(int id) { RouteValue...

Programmatically verifying a Web Reference matches an end point in .NET 3.5

I'm in the unfortunate situation where I need to consume web services that do not have a contract defined, as per normal SOA practices. This means that I need to guard against changes in the web services that break my web references. In the past, breaking changes in new web services versions such as the alteration of enumeration values h...

ASP.NET / C# - How to pop up a page with a listbox / multi-select control and send the selected IDs back to the parent page

Hello, I want to make a pop-up page that contains a listbox-type (multiselect) control which will return the selected IDs to the page that initiated the pop-up. This is an ASP.NET web application / C# 3.5 / Latest jQuery. I understand how to make the pop-up page with the corresponding controls, but I am unsure about the best way to ap...

Type 'Tamir.SharpSsh.jsch.JSchException' is not marked as serializable.

I have a .NET 3.5 MVC2 web app that runs fine from Visual Studio 2008 but when I publish to a remote site, I get an error in a certain function. Any idea what I should be looking for here? Event Type: Error Event Source: ASP.NET 2.0.50727.0 Event Category: None Event ID: 1334 Date: 24/08/2010 Time: 13:58:55 User: ...

C# 3.5 Reading Excel files

I have a strange behavior when i try to read an XML worksheet using this code : string CONNEC_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=No;IMEX=2;\""; string fullFilePath = @"C:\Tmp\TestFile.xls"; using (OleDbConnection objCon = new OleDbConnection(string.Forma...

return a filename

using openFileDialog will not return a filename in use, I want the filename only I don't care if it's in use The file will most likely be in use, I just want to be able to find the file and retrieve its name and location to perform a connection. OpenFileDialog works until I select the file, then it has a popup that says "File in Use". ...

Client Profile vs Full

I noticed that you can change the target platform in .NET applications to the Client Profile or the Full profile. What is the difference between the two? How should I choose which is the correct one for my project? ...

.NET Framework version

I have an app that was created using .net Framework 3.5. However, I now need to change this to use the 2.0 Framework, as it needs to be distributed to a Windows 2000 machine. Will simply changing the Application Target Framework on the project properties be sufficient to do this? ...

Risk of migrating website from .NET 2.0 to .NET 3.5

What are the inherent risk of upgrading a website from the 2.0 framework to the 3.5 framework? I know the features given to me in the upgrade, just curious if there are any known issues that may pop up when upgrading. I.E. Function X used to behave this way, and now behaves a new way. ...

Programatically attaching document(s) to an email in asp.net

I am generating an email via codebehind in C# in my asp.net application using the line below: ClientScript.RegisterStartupScript(this.GetType(), "FormLoading", "window.open('mailto:[email protected]?subject=Invoice for ABC Corp - " + ddlJobCode.SelectedItem.Text + " - Supporting Documentation', 'email');", true); Is it possi...

Sorting within gridview without any data binding control - how to do it?

Hi, I have a GridView control on my page. GV doesn't use any .net control as a data source to bind to data. I'm doing this in code behind where I'm creating my own DataTable and DataSet. Then I'm binding this DataSet to GV. Next i would like to enable of sorting colums. The issue is that this doesn't work as it should when you don't use...

GetProperty works in .NET 3.5 but not in .NET 4

I use following code: protected object GetProperty(object target, string fieldName) { Type type = target.GetType(); PropertyInfo mi = type.GetProperty( fieldName, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty); object obj = mi.GetValue(target, null); return obj; } It works in .NET 3....

Entity Framework and multithreading

Hi, I have a WCF service that processes some messages. I use EntityFramework to retrieve the messages. I add these messages to a ThreadPool queue and then process them. After processing all the messages, I call an update on the Entity Framework to update the status of the messages. Durng this operation, I randomly get the error - "Enti...

Scroll to bottom on new item. My method freezes scrollbar

I have a ListView that gets updated frequently, at irregular intervals. I want it so that when an update is received the item will be scrolled into view. I know the code to do that: logListView.ScrollIntoView(logListView.Items[logListView.Items.Count - 1]); I don't know where to put it so that it happens when the ListView is updat...

NUnit Assert.AreEqual DateTime Tolerances

Hey everyone, I'm wondering if anybody's found a good solution to this: In our unit tests; we commonly use Assert.AreEqual() to validate our results. All is well and good; until we start trying to use this on DateTime properties. Although the times are very similar, sometimes they are off by milliseconds, which causes the tests to fa...

how to pass jQuery variable to another page?

$(function() { $("#slider").slider({ value:0, min:0, max: 10, step: 1, slide: function(event, ui) { $("#amount").val(ui.value); $("#price").val('$'+ ui.value * $("#rate").attr("value") * 12); } }); $("#amount").val($("#slider").slider("value")...

Create a WPF text box which only responds to character key presses and few selected editing key presses

The WPF text box responds to quite a number of editing commands. I want to eliminate the vast majority and have it respond to any text input and few editing commands like backspace & delete. I know I can handle the KeyDown event but I can't see any easy way of distinguishing between character input and editing key strokes. ...

Func for 5 arguments

I am working with System.Func but have reached a stumbling block with it. System.Func<TReturn> // (no arg, with return value) System.Func<T, TReturn> // (1 arg, with return value) System.Func<T1, T2, TReturn> // (2 arg, with return value) System.Func<T1, T2, T3, TReturn> // (3 arg, with return value) System.Func<T1, T2, T3, T4, TReturn>...