.net

Working with Partial Views in ASP.NET MVC

Background I'm receiving the following error when trying to render a partial view in ASP.NET MVC. I am new to ASP.NET MVC and am sure the error is simple to resolve and just stems from my lack of complete understanding. Question (for those not wanting to read everything): What is causing this error ? Exception Details: System.I...

Programmatically create a SqlCE table from DataTable

Does anyone know the best way to create a SqlCe (Compact 3.5) table based on the schema of a DataTable at runtime? I don’t want to have to formulate a “CREATE TABLE” statement based on all the different possible data-types, etc. As a bonus – do you then know how to fill it directly from a datatable? ...

Obscuring a links url

Hi, Please pardon my ignorance. I'm looking for a point in the right direction. I have a page with some (pdf)download links. If I click the link a pdf will open in a new page. I can see the folder the pdf resides on the server. If I guess at other filenames in the same folder, maybe I can get lucky. Some of the files are private so I do...

Using Javascript OnChange Event to Conditionally Cancel AutoPostBack on Textbox

I'm having trouble figuring out a way to conditionally cancel an asp:TextBox's OnTextChanged AutoPostBack using a javascript onchange event. I want to do this because it would be easy for me to check some conditions on the client side that would negate the necessity of doing a post-back. I have something like this generated in the cli...

Start a new process in a transaction

Hi, I have to create a user in a third party application that stores its information in SQL Server, and I also store information about this user in our application database, also in SQL Server. I was hoping to wrap both updates in a TransactionScope, so they can succeed or rollback together. Unfortunately the only method I have for cre...

.NET / C# Binding IList<string> to a DataGridView

I have an IList<string> returning from a function (as variable lst) and I set and then I this.dataGridView1.DataSource = lst; The datagrid adds one column labelled Length and then lists the length of each string. How do I make it just list the strings? ...

Is there a way to dynamically create a type's property names while maintaining design-time intellisense?

The simplest example would be the built in class keyValuePair(of T,U). I would like to be able to name the key property and value property differently depending on the usage and the designtime intellisense show me those names instead of key and value. Could this be done with reflection.Emit? Can it be done another way? This seems like a...

Auto-Initializing C# Lists

I am creating a new C# List (List<double>). Is there any way, other than to do a loop over the list, to initialize all the starting values to 0? Thank you. ...

Is it possible to apply a publisher policy to a strongly named, privately published assembly?

I have created a common library at work, but unlike in this question, it is not published to the GAC. Instead, it is privately published to a company-specific installation folder. EDIT: all the internal apps go into this same folder. Is it still possible to apply a publisher policy, allowing older applications to use newer versions of...

Logging in APIs

When I'm writing an API assembly for someone else to use, it would be useful to have some logging capability to help diagnose the clients' problems using it. However, if I reference, for example, log4net in my assembly, this might clash with the version of log4net being used by the client's application. I don't want to reinvent the whe...

How can I capture a SQL Stored Procedure Error triggered by RAISEERROR() in .asmx file?

I'm very new to .NET. All I've done so far is implement some SQL Stored Procedure calls as WebServices by copying and pasting existing code (as instructed by my superior). I am calling some commands via Database.ExecuteNonQuery(). In the SQL Stored Procedure, I am performing some security checks based on the LoginId passed in (a user ca...

Controlling ASP .Net repeater control output height

Hi, I'm currently implementing an RSS feeder control for a website. I'm planning to allow a limit of 10 items to be displayed on the homepage using a repeater control. My question is how do I prevent the height of the control exceeding a certain dimension? I cannot guarantee how much content will be provided per RSS feed item. One op...

Should I use the Debug class in .net?

I've been reading a lot about the Debug class lately. I'm pretty torn about it personally. I can see it improving the process of creating really tricky algorithms. But it also adds a lot of code to my app that I have to wade through unnecessarily. Having a Debugger should remove the need for boiler plate code, whether it is stripped ...

Preventing a DataGridView from selecting the first item

I have a WinForm DataGridView that when I populate it with data the first item is selected by default. I don't want this to occur as to when an item is selected an event fires and some code is executed. Solutions I have for this is to unhook-bind-rehook the event or have a flag that is changed the first time the event fires after a new...

Call a function if its DLL is available?

I want to call managed code if and only if the currently executing assembly references it and has a match for that function name. I have a function Public Function TestReadableProperties() As String ' Not sure where to go with this line ' Dim names = Reflection.Assembly.GetExecutingAssembly.GetReferencedAssemblies() Ret...

Use .NET Remoting to transfer a file?

I'm using .NET remoting to communicate between a web site and a Windows service. They both live on different machines. I have a statically defined port number for use by all requests and responses. I also use this mechanism to transfer files from the web site to the Windows service box. I'm passing a Stream object in the object that ...

How to auto-build custom commands in a DataSet based on non-"DELETE" deletion method?

I am using DataSets for access to Sql Server 200x in a C# project. Our common practice is, in almost all tables, to not delete the record. Instead we have a field which simply holds a bit for whether the record is deleted. I can manually edit each table in the DataSet and make their select command include Where Deleted = 0 and the del...

WPF Image and DirectX SurfaceFormat

I have a 16 bit grayscale image that I want to display using WPF in .NET 3.5 sp1. Currently, I display that image using an embedded winform that uses OpenGL to set the image display format to Luminance 16. DirectX has a similar property, SurfaceFormat. I want to be able to display an image in WPF and set the SurfaceFormat to Luminan...

C# Serialize XmlDocument & send via HTTPWebRequest

I'm trying to figure out how to properly serialize my XmlDocument and send it via a HTTPWebRequest object. Heres what I have thusfar: Stream requestStream; HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://wwwcie.ups.com/ups.app/xml/Track"); request.Method = "POST"; request.ContentType = "application/x-www-form-urle...

what are the possible problems with CLR integration in Sqlserver

I read an article about using CLR integration in sqlserver and was wondering what some of the potential problems might be, if any. My thought was using it for validating potentiality bad data in a legacy Database. an example is a persons name in the phone number column. Edit: I don't think there are any problems, but it's not somethi...