Category Archives: ASP.NET - Page 4

Новости в Visual Studio 2008 beta 2

Наскоро Microsoft представиха последните версии на Visual Studio 2008 и .NET 3.5 beta 2. Visual Studio 2008 можете да изтеглите от тук, а умалената експрес версия от тук. Важно е да отблежим, че новите версии можете да инсталирате съвместно с по-старата VS 2005.

Ето и някои от последните нововъведения в Visual Studio 2008:

- Поддръжка на Multi-Targeting – VS 2008 ви дава възможност да създавате приложения предназначени за различни версии на .NET Framework. Лесно може да се превключва от една версия на друга.

- VS 2008 Web Designer и поддръжка на CSS – в тази версия е включен подобрен HTML web designer. В него се поддържат ‘двоен’(сплит) изглед, внедрени една в друга master pages, и подобрена CSS поддръжка.

css Новости в Visual Studio 2008 beta 2

- ASP.NET AJAX и поддръжка на JavaScript – в .NET 3.5, ASP.NET AJAX е внедрен, както и са добавени нови функционалности като UpdatePanel с WebParts, поддръжка на WCF за JSON, и редица други подобрения по бързодействието. VS 2008 има и увеличена поддръжка относно интегрирането на JavaScript и AJAX в приложенията. Новото студио се отличава с подобрен Intellisense, който дори работи при включени външни JavaScript файлове.

js Новости в Visual Studio 2008 beta 2

- Езикови подобрения и LINQ – новите компилатори на VB и C# имат доста подобрения относно функциите на езиците. Това основно се забелязва при LINQ(language integrated query) който добавя нови възможности при заявки и работа с данни. Ето и някой от подобренията налични в C#:
o Automatic Properties, Object Initializer and Collection Initializers
o Extension Methods
o Lambda Expressions
o Query Syntax
o Anonymous Types
lambda Новости в Visual Studio 2008 beta 2

- Подобрен достъп до данни чрез LINQ към SQL
LINQ към SQL е внедрен OR/M (object relational mapper) в .NET 3.5. Той ви дава възможност да правите заявки чрез LINQ, както и да редактирате/изтривате и вмъквате нови записи. LINQ към SQL напълно поддържа транзакции, изгледи и запазени процедури.

dataaccess Новости в Visual Studio 2008 beta 2

Това са само някои от многото подобрения представени в новата версия. Дотук всичко е добре, но лично за мен остават отворени въпросите:
– Ще успеят ли да разработят всичките езикови подобрения и за Visual Basic?
– Ще успеят ли до Февруари 2008 да са готови с крайната версия?

Using ASP.NET AJAX Control Extenders in VS 2008

Scott Guthrie again shows one of the new feature of the new Visual Studio 2008 which is the improved designer support for ASP.NET AJAX Control Extenders.

What are ASP.NET Control Extenders?

ASP.NET Control Extenders are controls that derive from the System.Web.UI.ExtenderControl base class, and which can be used to add additional functionality (usually AJAX or JavaScript support) to existing controls already declared on a page. They enable developers to nicely encapsulate UI behavior, and make it really easy to add richer functionality to an application.

The ASP.NET AJAX Control Toolkit is a great example of a project that takes advantage of this control extender functionality. It includes more than 40+ free control extenders that you can easily download and use to add AJAX functionality to your applications.

For example, let’s assume we wanted to have a textbox on a page where a user could enter a date:

step1 Using ASP.NET AJAX Control Extenders in VS 2008

If the browser has JavaScript enabled, we might want to have a nice client-side calendar date picker appear when the user sets the focus on the date textbox to help with selecting the date:

step2 Using ASP.NET AJAX Control Extenders in VS 2008

Enabling this is trivial using the ASP.NET AJAX Control Toolkit. Just add the “CalendarExtender” control that ships with it to the page and point its “TargetControlID” property at the :

step3 Using ASP.NET AJAX Control Extenders in VS 2008

The CalendarExtender now automatically emits an ASP.NET AJAX javascript client script that adds the client-side calendar behavior to the TextBox at runtime. No additional code is required.


Using ASP.NET AJAX Control Extenders in VS 2008

With VS 2005 you had to manually wire-up control extenders yourself (either via source-view or via the property grid).

VS 2008 makes it even easier to discover and attach control extenders to your controls.
read original

Using LINQ to XML (and how to build a custom RSS Feed Reader with it)

Here is latest post from ScottGu’s blog. There he describes how to build a custom RSS Feed Reader using LINQ to XML. Check it out:

One of the big programming model improvements being made in .NET 3.5 is the work being done to make querying data a first class programming concept. We call this overall querying programming model “LINQ”, which stands for .NET Language Integrated Query.

LINQ supports a rich extensibility model that facilitates the creation of efficient domain-specific providers for data sources. .NET 3.5 ships with built-in libraries that enable LINQ support against Objects, XML, and Databases.


What is LINQ to XML?

LINQ to XML is a built-in LINQ data provider that is implemented within the “System.Xml.Linq” namespace in .NET 3.5.

LINQ to XML provides a clean programming model that enables you to read, construct and write XML data. You can use LINQ to XML to perform LINQ queries over XML that you retrieve from the file-system, from a remote HTTP URL or web-service, or from any in-memory XML content.

LINQ to XML provides much richer (and easier) querying and data shaping support than the low-level XmlReader/XmlWriter API in .NET today. It also ends up being much more efficient (and uses much less memory) than the DOM API that XmlDocument provides.


Using LINQ to XML to query a local XML File

To get a sense of how LINQ to XML works, we can create a simple XML file on our local file-system like below that uses a custom schema we’ve defined to store RSS feeds:

step2 Using LINQ to XML (and how to build a custom RSS Feed Reader with it)

I could then use the new XDocument class within the System.Xml.Linq namespace to open and query the XML document above. Specifically, I want to filter the elements in the XML file and return a sequence of the non-disabled RSS feeds (where a disabled feed is a element with a “status” attribute whose value is “disabled”). I could accomplish this by writing the code below:

VB:

step4 Using LINQ to XML (and how to build a custom RSS Feed Reader with it)

read whole article

Visual Studio 2008 and ASP.NET 3.x

Rick Strahl is again sharing his thoughts about VS 2008 and the new ASP.NET 3.x, here is part of it:

I’ve been running Orcas quite a bit since Beta 1 was released in April and overall I’m pretty damn happy with this update to Visual Studio 2008. You may have noticed that I HAVEN’T posted a lot about Orcas issues and that’s because overall Visual Studio Orcas and the feature set is working rather well for me. Microsoft has really done a much, much better job this time around to provide a sane set of updates to the framework as well as what amounts to an incremental update in Visual Studio.

Visual Studio 2008 is interesting on several levels. First and I think this is very significant is that it works with .NET 2.0 and you can build applications that run on .NET 2.0. This means it’s possible to take advantage of many of the new features in Visual Studio – especially the new designer and the somewhat improved JavaScript support – even for today’s projects. That makes the new tool very palatable to try and play with immediately. I’ve moved several of my internal applications to Orcas and it’s been a pleasure working in VS 2008.

Second although there are some major changes in the editors, overall the Visual Studio shell isn’t completely changed. In fact, most of my add-ins, Intellisense scripts, templates etc. all work in Visual Studio 2008 which gives me my base toolset I work with and helps with productivity. I’m really glad that there wasn’t another complete overhaul of the system that required everything to be at least recompiled if not to be redesigned.

One of the biggest advantages in VS 2008 is the new HTML editor both for markup and design view. It’s based on the same editor that’s in Microsoft Web Expression (which is a great tool BTW and which I use daily!) and provides a ton of improved functionality and much better rendering. However, the biggest bonus that you’ll notice immediately with the new editor is that it is much, much faster than the VS 2005 editor. You know the feeling in VS 2005 as you open a markup or worse a designer page and you wait and wait and wait some more. With VS 2008 that is no longer the case – activating markup or design view happens in a second or two even for complex pages. Not only that but because there’s split view for design and markup you rarely switch views and because both panes stay in sync the whole experience is much more expressive. The editor and speed alone is a big productivity improvement at least for me.

That isn’t to say that that there aren’t problems with VS 2008. Yes some things are broken and Orcas will crash occasionally (although not any more than VS 2005) but overall the experience for a Beta 1 product is very good! Good enough to be productive with it.

ASP.NET 3.x

I’ve also spent a bit of time working with .NET 3.5 mostly for back end related framework stuff. There’s a lot of interesting stuff but most of the really cool features of .NET 3.5 are related to LINQ and the language enhancements in C# and VB.NET many of which are very useful productivity enhancers. I’ll post more on some of this in the coming weeks.

But what’s interesting is that there’s not a lot of new stuff for ASP.NET 3.5. In fact looking through the System.Web.Ui namespace with Reflector there’s only a couple of new controls – the ListView and DataPager. ListView is a new control that’s sort of a mix between a repeater and a GridView. It provides the rich templating of a Repeater combined with the grid’s advanced features like Paging, Sorting and Editing. It’s interesting but hardly something to jump up and down about. There’s also a LINQDataSource which makes it easy to create and consume LINQ data. That’s about all that I could find that was obvious. I spent a bit of time looking around trying to find more information on what’s new in ASP.NET but couldn’t really find anything else of note. It’s clear that the core of new features that will impact ASP.NET 3.5 are going to be related to the language enhancements and LINQ.

Disappointing? Not at all!

It’s important to remember that the ASP.NET team has already delivered very important support features prior to the Orcas release cycle. Specifically I’m thinking of ASP.NET AJAX and full support for the IIS 7 integrated pipeline, which in my opinion really counts as the ASP.NET 3.0! IIS 7 and the integrated pipeline opens up many new possibilities for deep Web server integration and it’s great to see that this whole new pipeline model was able to integrate with ASP.NET so seamlessly that as a developer you never actually know the difference.
read original

LINQ to SQL (Part 5 – Binding UI using the ASP:LinqDataSource Control)

Hi all, I have been quite busy lately so didnt got much time to post here, but now will try to catch it up. Here is a post from Scott Guthrie which is PART 5 of his LINQ to SQL series:

Over the last few weeks I’ve been writing a series of blog posts that cover LINQ to SQL. LINQ to SQL is a built-in O/RM (object relational mapper) that ships in the .NET Framework 3.5 release, and which enables you to easily model relational databases using .NET classes. You can use LINQ expressions to query the database with them, as well as update/insert/delete data.

Below are the first four parts of my LINQ to SQL series:

In these previous LINQ to SQL blog posts I focused on how you can programmatically use LINQ to SQL to easily query and update data within a database.

In today’s blog post I’ll cover the new control that is shipping as part of ASP.NET in the upcoming .NET 3.5 release. This control is a new datasource control for ASP.NET (like the ObjectDataSource and SQLDataSource controls that shipped with ASP.NET 2.0) which makes declaratively binding ASP.NET UI controls to LINQ to SQL data models super easy.


Sample Application We’ll be Building

The simple data editing web application I’ll walkthrough building in this tutorial is a basic data entry/manipulation front-end for products within a database:

step03 LINQ to SQL (Part 5   Binding UI using the ASP:LinqDataSource Control)

The application will support the following end-user features:

  1. Allow users to filter the products by category
  2. Allow users to sort the product listing by clicking on a column header (Name, Price, Units In Stock, etc)
  3. Allow users to skip/page over multiple product listings (10 products per page)
  4. Allow users to edit and update any of the product details in-line on the page
  5. Allow users to delete products from the list

The web application will be implemented with a clean object-oriented data model built using the LINQ to SQL ORM.

All of the business rules and business validation logic will be implemented in our data model tier – and not within the UI tier or in any of the UI pages. This will ensure that: 1) a consistent set of business rules are used everywhere within the application, 2) we write less code and don’t repeat ourselves, and 3) we can easily modify/adapt our business rules at a later date and not have to update them in dozens of different places across our application.

We will also take advantage of the built-in paging/sorting support within LINQ to SQL to ensure that features like the product listing paging/sorting are performed not in the middle-tier, but rather in the database (meaning only 10 products are retrieved from the database at any given time – we are not retrieving thousands of rows and doing the sorting/paging within the web-server).

read original

ASP.NET, ASP.NET AJAX, Visual Studio, Silverlight and IIS7

This is last list published by Scott, in which he presents latest articles and posts relating ASP.NET, ASP.NET AJAX, Visual Studio, Silverlight and IIS7. Check it out here, at the bottom is a link to the original:

ASP.NET

  • ASP.NET RSSToolkit 2.0 Released: One of the cool projects for ASP.NET 2.0 that was released last year was this free RSS Toolkit – which makes consuming and exposing RSS feeds in ASP.NET super easy (you can even databind any ASP.NET control against them). The team working on the CodePlex project has recently released V2 of the RSSToolkit. You can learn all about it and download it here.

  • Building a Custom Database Driven Site Map Provider: Scott Mitchell has written a great article on how to implement your own site map provider for ASP.NET that is populated from a database (instead of statically from an XML file). You can learn more about the ASP.NET 2.0 SiteMap system from this older blog post of mine here.

  • .NET DateTime and Number Format String Cheat Sheet: If you are like me, you might have trouble remembering all of the standard format strings you can pass to the String.Format() method and/or the Eval() databinding method in ASP.NET to generate the appropriate string output from a DateTime or Numeric datatype. This PDF cheatsheet is a useful one to download and save to quickly look these format strings up. John has some other really useful .NET PDF cheatsheets he has also created that you might like to download here.

  • Profile Support for ASP.NET Web Application Projects: VS 2005 Web Application Projects can’t directly access the strongly-typed ASP.NET “Profile” object that web site projects support. This VS add-in supports the ability to generate a strongly typed profile class to accomplish this. You can read this great series of posts to learn more about how to use the ASP.NET 2.0 Profile system. I have it on my list of tips/tricks posts to-do to cover using this VS add-on as well.

  • ASP.NET Photo Handler: Bertrand has posted a cool photo album HttpHandler for ASP.NET that allows you to easily drop images into a web directory and automatically generate a nice photo album of them (complete with EXIF information, stack sorting icons, etc). Might be very useful for people enjoying holidays this summer. Download the code here.

  • BlogEngine.NET: This is a new open source blog engine for ASP.NET that Mads Kristensen has helped start up, and which I’ve heard a lot of good things about. You can read about its features here, and download it here.


ASP.NET AJAX

  • ScriptDoc 1.0 Available: Bertrand Le Roy has published a cool ScriptDoc utility that extracts documentation from JavaScript files and packages it into XML that can be consumed by documentation building tools. A very useful tool as you start to build up your own JavaScript libraries.


Visual Studio

  • GhostDoc 2.1.1 Released: GhostDoc is a free add-in for Visual Studio 2005 (and now 2008) that automatically generates default XML documentation comments for code you write in C# or VB. It can automatically re-use existing documentation inherited from base classes or implemented interfaces, or generate initial documentation by deducing comments from the name and type of the member signature. You can learn more about it and download it for free here.


Silverlight

  • Silverlight Tutorials: Michael Schwarz has a great blog where he writes regularly about Silverlight. This tutorials link points to a bunch of great Silverlight content.


IIS 7

  • IIS 7.0 is now running all of Microsoft.com: One of the things we push at Microsoft is to “dogfood” our products on our high volume sites when they enter the beta cycle. As of a few weeks ago, all of the web servers running www.microsoft.com are now running on IIS7 and Windows 2008 Server Beta3. These servers host 500+ virtual roots and 350 ASP.NET applications, and handle 300,000 concurrent connections. IIS7 is going to be an awesome release.

  • IIS 7.0 on Server Core: Bill Staples blogs about some of the new IIS7 enhancements that appear with the June CTP of Windows 2008 Server. One of the big features that is now supported is the ability to install IIS7 on “server core” – which is a low footprint installation of Windows 2008 Server that lays down just the minimal footprint needed to boot (meaning no GUI shell). This lowers the resources required on servers, and even more importantly means that servers don’t need to be updated if a patch is released for a component not installed on the server (which lowers the downtime of servers). ASP.NET and the .NET Framework aren’t supported yet in server core configurations – but will be in the future.

read original

Updated ASP.NET AJAX Control Toolkit Release and New ASP.NET AJAX Videos/Articles

Scott Guthrie put all these links together! Check them out here, thanks Scott!

Last week the ASP.NET AJAX Control Toolkit team released Build 10618 of the ASP.NET AJAX Control Toolkit. This fixed a few issues discovered with the release earlier this month including:

  • A fix for the Tabs naming container
  • A fix for a VS design-time dependency
  • FilteredTextBox Navigation and control key issues

This build also contains additional performance optimizations for the new “script combining” feature provided by the new ToolkitScriptManager control. This feature can help significantly improve performance for pages with multiple AJAX scripts that previously needed to be downloaded separately. David Anson has a nice blog post that talks about these improvements here.


New ASP.NET AJAX Videos

Joe Stagner has recently posted five new (free) ASP.NET AJAX videos on www.asp.net:

step1 Updated ASP.NET AJAX Control Toolkit Release and New ASP.NET AJAX Videos/Articles

You can download and watch the videos here. These new videos are available to download in a variety of video and audio formats including: WMV, Zune, iPod, PSP, MPEG-4, and 3GP.


New ASP.NET AJAX Articles

Here are a few recent ASP.NET AJAX articles you might also want to check out:

  • ASP.NET AJAX UpdatePanel Tips and Tricks: This is a great MSDN Magazine article by Jeff Prosise that covers: update highlighting, how to cancel updatepanel updates, optimizing with conditional updatepanels, and using page methods.

  • AJAX Control Toolkit Patch Utility: If you are not an official contributor to the ASP.NET AJAX Control Toolkit project, but would like to submit a bug fix or small feature into the toolkit, you can read this article to learn how to create and submit a patch to the team for them to review and potentially include.

read original

Creating Packaged ASP.NET Setup Programs with VS 2005

Great article by Scott Guthrie in which he describes how we can create packaged ASP.NET Setup Programs with VS 2005:

Scenario

You have built an ASP.NET Web Application using Visual Studio 2005, and want to enable customers to automatically install and deploy it on servers via an easy setup program.

Specifically, you want to create a standard Windows setup program that will create and configure the application on IIS, copy all of the application’s files to the appropriate location on the server, and ensure that ASP.NET 2.0 is correctly mapped to run the application. You also want the setup program to prompt the customer for the database location that the new application should use, and have the setup program automatically update the web.config file with the database connectionstring settings the customer provided.

One solution to consider using is the built-in “Web Setup Project” support that is built-in to Visual Studio 2005. Web Setup Projects can be used to pipe the compilation outputs from VS 2005 Web Application Projects as well as Web Site Projects (when used with VS 2005 Web Deployment Projects), to create encapsulated Windows setup programs. The below walkthrough demonstrates step-by-step how to create and use one.
read original