asp.net

GridView Sorting on List

I have the following code: var emp = new List<Employee> { new Employee{ID=1, EmpFname="matt", EmpLName="Cook"}, new Employee{ID=2, EmpFname="mary", EmpLname="John"} // and so on }; How do I sort emp by EmpLName and bind it to a GridView? How do I specify asc or desc? If anyone could explain it using LINQ/Lambda express...

asp.net DataPager, set PageIndex

I have a search that uses a ListView to display the results. I also use a DataPager to handle pagination of the results. <asp:DataPager ID="dpProducts" PagedControlID="lvProducts" runat="server" PageSize="12"> <Fields> <asp:NextP...

using a public static class in a 'Project' with defined namespaces

In the past, I have not really used namespaces, but in this project I am using SourceSafe which requires a project, which puts everything in namespaces... In the past, I have just been able to make a public static class in the App_Code folder and access it frorm anywhere in my application, but now I cant seem to do that. For example, m...

Microsoft Enterprise Library 3.1 - Validation - Message From resx

Hi, I am trying to use the Enterprise Library 3.1 Validation Block for validating my objects in a new project. This application is to be multi-lingual and as such need to be able to put my error messages into resx files. How would you go about doing this? Would you use the config section or Attributes on the objects themselves and how d...

Good way to make a repeating template for data in asp.net

I'm building a webpage on which I display the n newest newsposts on the front page, and this is the method that gets the posts and returns them to the .aspx-file. I use a asp:substitution-control to insert the string into the webpage. I think my way of doing this i kind of messy and ugly, and not very flexible if i want to do little cha...

I want to Automatically Generate Code

Hi Experts. I have a large SQL Server database and I want to automatically generate ASP.NET and AJAX code from the database. Can I do it using any Free Tool (please tell free ones only)? I also want that tool to generate C# code only. Any article/whitepaper on the tool is appreciated. ...

Why should I use JSON with ASP.NET?

Why should I use JSON with ASP.NET? Can you give a practical example? I have read articles but not so good. ...

How to save pdf filled in form back to web server

I need to be able to view an embedded pdf in an ASP.Net form as well as print and save the document back to the web server. The pdf document allows filling out of various fields and I also need to have a Print and Save button that's on the form that's not in the pdf default viewer. So the scenario is the user opens a pdf document in an ...

ASP.NET Ajax script registration

When should I use ScriptManager to register scripts and when is it ok to use the Page.ClientScript? What are the rules? ...

ASP.NET Cookie Expires value resets on Response.Redirect?

I have a script that reads a form and puts some info into a cookie: Dim oCookie as HttpCookie oCookie = New HttpCookie("authInfo") Select Case oResult Case "No ClientID", "No Password", "No PracType", "No Encrypt", "CRC Mismatch" oCookie.Values.Add("LoggedIn", "False") oCookie.Values.Add("OnSupport", "False") Case "Client Can Up...

Asp.net MVC Module binding with validation for Complex Types

I'm building a questionnaire app in asp.net mvc, and I'm having trouble with the module binder for a list of complex types. First: I can't get Questionnaire.IList<QuestionGroup>.IList<Question> object graph to work with the binder. So in the sample code below i use only one level IList. Second: I would love to pass in my repository/...

SQL Server 2005: Transaction Deadlock

Hi ppl, I am getting this error very frequently but not consistently on 2 pages in an application which is in a production environment. I just have some screen shots of the error below. Transaction(Process ID XX) was deadlocked on lock | communication buffer resources with another process and has been chosen as a deadlock victim. Reru...

ASCX files

I have a web application project that contains only .ascx files. I build it to create a dll and then reference the dll from another web app project. Do I need to copy over the .ascx files over the the site as well. If i need to copy them over, where do i need to place them? EDIT: I was able to fix the cause of this problem. The web a...

ASP.NET Web Deployment Projects: getting rid of .compiled files

I'm using a Web Deployment Project in Visual Studio 2008 in order to prepare my ASP.NET application (ASP.NET web application, not ASP.NET web site) for being copied to several servers. I have to copy the files on local staging servers, on different servers via FTP and sometimes I have to fetch them from customers' servers. So, it would...

How to run just one ASP.NET Development Server in Visual Studio 2008?

I have several web application projects in one solution. When I start debugging one of those web applications I noticed that the ASP.NET Development Server starts for all web applications in my solution. How can I determine to just one ASP.NET Development Server to be started? Is this even possible? I don't want to have my system tray f...

Why can't I bind a formview to this datasource?

I've got this code here: SqlCommand CodeStatus = new SqlCommand(SQL, DB); DB.Open(); Reader = CodeStatus.ExecuteReader(); FormView1.DataSource = Reader; FormView1.DataBind(); DB.Close(); It works with a gridview, which then displays the data, but with this formview it doesn't display the data. Why not? The default mode is read...

Using two user controls on the same page?

Hello, I have a user control in a master page and the same user control directly in the aspx. The user control in the master page works fine, but when I try the user control that is embedded directly in the aspx page, it doesn't work. The user control is 2 textboxes with a login button. What it looks like it is trying to do is when I...

ASP.NET sessions timing out using SQL Membership Provider

Hi. I changed over from the in process membership provider to the sql membership provider to stop people losing their sessions when the website process recycled, but sessions still seem to time out. Are there any other things (apart from the session timeout variable set in the web.config) that would cause a session to timeout when usin...

How can I monitor active computers on my network in ASP.NET?

How can I know which machines are alive on the same LAN as my PC using ASP.NET? ...

A sensible PasswordStrengthRegularExpression

We're using the standard ASP.NET authentication provider (AspNetSqlMembershipProvider as it happens) and the defualt password strength requirement is a little excessive for our needs. We require our users to enter a password that is alphanumeric at least (i.e, letters and at least one number mandatory, mixed case and non-alphanumeric ch...