asp.net

How not to upload file on submit

I have a form in asp.net with a FileUpload control inside. Next to this control I have "Upload" button which is used to upload a file to a list of files. The problem is that I also have "Submi"t button used for submiting whole form. Now when somebody selects a file through browse button and presses on "Submit" not "Upload" file is being...

Using the SQL Command object, how can you check to see if the result set is empty?

Using the ExecuteScalar method in the SQL Command object, how can you check to see if the result set is empty? I am using ASP.net, C#, and MS SQL 2008. Right now when I run the following code the Response.Write returns a 0 when the resultset is empty. But I would like to differentiate between 0 and empty resultsets because there are a...

Controller's Json() Method Not Returning Array

Hi All, I'm just building my first MVC application and hitting a problem trying to perform a search using AJAX/JSON. The problem seems to be that the JSON returned by my controller is not an array meaning that I can't use jQuery's $.each method to iterate over my items. I'm trying to search for a user by e-mail address. I've got a Sear...

ASP.NET MVC suitable to complex web application?

Last week , my boss ask my team to evaluate ASP.NET MVC, for next project. all of us working with webform since .NET 1.1, we have no MVC experience before ,but all of my colleague are interest in ASP.NET MVC ,But no luck , our finally answer is NO. Because: 1. we believe although you are ASP.NET Guru, you can build a complex application...

Error when using link href inside my ContentPlaceHolder

I am using a MasterPage in my project... This this the link i need to place inside my ContentPlaceHolder of my Dedault.aspx page <link href="jquery/imagebox/imagebox.css" rel="stylesheet" /> But i get a error "Element link cannot be nested within element td" Any idea what to do? ...

Jabber integration in ASP.NET

Hi, I'm looking for an AJAX-enabled web client for Jabber. I found some, but they look hard to integrate with ASP.NET. Some of them were not even tested in IE. I'm trying to make an Facebook-like chat client, any suggestion is welcomed? ...

ASP.NET MVC > ASP.NET WebForms, Why?

I've now completed my first web application using ASP.NET MVC and overall, I still am not grasping why this is getting all the praise and glory. Maybe I'm being stubborn. I know that what makes MVC great is that is forces separation between the presentation layer and the business object or data layer along with its stateless operation. ...

What is the best way to allow a user to search through a large list on a web page?

I'm writing an ASP.NET MVC application and I have a form where a user can enter one or more part numbers that they used to fix a problem. Most of the time they know the part number and can just type it in. Occasionally, however, they need some extra help. The part number table has over 50,000 items in it which is way too big for a d...

Automate VS2005 Publish Web Application Project

I want to automate publishing a VS2005 ASP.NET Web Application Project to a disk path from the command line as part of my build process (i.e. the equivalent of selecting Build/Publish from the IDE). I've tried Microsoft's Web Deployment Project, and it seems half-baked to me: it deploys files that are not part of the Web Application pro...

ASP.NET 2.0 Security Membership Provider Pattern

Hi, I am creating a website in ASP MVC. Can anyone give me some advice on using the built-in membership provider in the following way. I want my users to create an Administrative account for themselves and then create accounts for the people in their organization, or the people that they want to give access to. I guess in a Database i...

Sorting a list using Lambda/Linq to objects

I have the name of the "sort by property" in a string. I will need to use Lambda/Linq to sort the list of objects. Ex: public class Employee { public string FirstName {set; get;} public string LastName {set; get;} public DateTime DOB {set; get;} } public void Sort(ref List<Employee> list, string sortBy, string sortDirection) { ...

masterpage module override

I have a masterpage which is set via a HTTPModule on PreInit(). HAPPY TIME! Problem is I need to override the masterpagefile value on a few pages due to a layout issue. Anyone know the best way? I tried adding a Page_Preinit on my page, but it is executed before the PreInit() in my module, so it ends up being reset there. I'm thinki...

ASP.NET MVC. No idea how to use Url.action to pass an object to the controller

I am new to asp.net MVC. I was able to create my view and display the data (Gridview). Additionally, I was able to create a hyperlink (using Url.Action) passing string and int types. However, I want to create a hyperlink that it is referencing a more complex type. The class associated with my view has a reference to a List. What I want i...

AJAX Toolkit controls showing errors in designer

Is there something I need to install to get Ajax Toolkit control support in "design" mode in VS2008? Also, I seem to be having a problem when adding controls within Ajax controls. They don't update the designer.cs file. ...

Gridview Column Removing

Hi, I have a web application that I am working on(ASP.NET 2.0 C#). In it I have a GridView whose data source is an Oracle database. I get the data into the gridview in my codebehind, and don't set the datasource directly. I wanted to create a hyperlink field (NAME) that takes me to a details page about a specific record. What ends up...

Determining which properties to serialize in a class that's passed over a webservice

I'm using NHibernate to administer my entities, and to have lazy loading enabled I need to make my properties return an IList<>. Problem is that .NET throws an exception as it can't serialize an interface when I'm trying to pass the entity. This makes perfect sense. What I need to know is how I can control which fields to serialize, and...

What type to use to save a set of values in user control's state?

I have a base class for some kind of user controls, and in that base class and in its inherited classes I want to store some properties. I use protected override object SaveControlState() protected override void LoadControlState(object savedState) methods to save or load my custom values. Since I can work only with 1 parameter of typ...

Problem with MaskedEdit from Ajax Control Toolkit - different culture

I want to use maskededit to make the user to do the same as in the ajax control toolkit sample for maskededit, but I need to use another format, since dates at my client is displayed as dd-MM-yyyy. I also need to put a value in there to begin with, since the date is loaded from a db (once I get this code working, that is) Look at this s...

ASP.NET MVC plus Silverlight

It seems to me that, for structured development with both depth and breadth of capability, ASP.NET MVC and Silverlight have the potential to make a nice powerful framework with superior UI granularity and reduced AJAX exposure. Have any of you tried building such a stack with future durability in mind? ...

Why is the data from my html form not submitting?

I am developing asp.net mvc application. I have a section on the form where I add some text boxes dynamically when the user clicks a "Add New Part" button. The problem is when I submit the form I don't get the data from the fields I added dynamically. I am passing the FormCollection to my controller and stepping through the code in th...