check out the PDC09 videos

check out the PDC09 videos here

Managed Extensibility Framework

The Managed Extensibility Framework (MEF) has been getting a lot of interest lately and it’s something that’s out on CodePlex and it’s also part of .NET Framework 4.0.

It’s also part of Silverlight 4.

The name’s a good one – it’s a framework for building an application that is made up of a bunch of loosely coupled components with a lot of flexibility around component discovery, registration, lookup and lifetime management. If I had to sum it up in my own words I’d say something like;

MEF composes an application by extensibly discovering a set of components which offer exported functionality and ( possibly ) rely on imported functionality. The link between the two is a simple string name ( a MEF “contract name” ) which is usually represented by a .NET type name and MEF has the capability to plug things together where it finds ( possibly further constrained ) matches.

Read full post of mike here

How to check if Silverlight Running out of browser or in the browser ?

As Silverlight increases its Out of Browser features it will become more important to detect if the application is running in or out of the browser.  This is the check:

if (Application.Current.IsRunningOutOfBrowser)
{
// Out of Browser

}
else

{
// in the browser

}

Getting Started with Silverlight 4 Beta

Thanks to Andy…….

Here are some links to get you past the burn and into the groove...

Silverlight 4 Beta, RIA Services... and Beer!
I've updated my Beer database demo with a walkthrough for Silverlight 4, VS2010, and the latest RIA Services.

Silverlight 4 Beta: Implicit Styles
We've been waiting for this little feature for awhile! Finally we can set a global style for a control.

Silverlight 4 Beta - A Guide
This is a great overview of new stuff from Tim Heuer.

Silverlight 4 Tech Whitepaper
John Papa walks through lots of the new goodies in SL4.

Why will Silverlight 4 be better for Business App Development?

 

  1. RIA Services
    WCF RIA Services (formerly .NET RIA Services) makes it quick and easy to create a Service layer that wraps your Data Access Layer - whether your DAL uses the Entity Framework, LINQ to SQL, or another technology. Note the name change from ".NET RIA Services" to "WCF RIA Services." As confusing as another name change is, this helps clarify that this new release is built on top of WCF - The communications channel from the Silverlight client to the RIA Domain Service is now a *.svc file - which means we can Add a Service reference to the service side, get WSDL, and customize WCF service settings.
  2. Cider Support
    VS2010 includes a XAML editor (Cider), supporting drag/drop forms design and data binding. In the past, developers needed to learn Blend to do basic GUI form design. Don't get me wrong, I love Blend : and we will still need to switch over to Blend to take advantage of Behaviors, States, Templating, animation, drawing, and other tasks. But many developers were turned off by the fact that Visual Studio had no WYSIWYG designer for XAML.
  3. Data Sources Window
    WCF RIA Services and VS2010 now support a rapid Drag/Drop design experience which allows you to quickly put together data-enabled Silverlight applications.

Silverlight 4 Beta is Now Available

Yesterday, at the PDC in Los Angeles, Scott Guthrie announced the availability of Silverlight 4 beta, just four months after bringing Silverlight 3 to market. With the help of several customers we showcased the new features that will enable developers to create the highest quality media and RIA applications for the Web and desktop. These powerful new features offer developers significant benefits in rapidly creating rich software experiences, and include:

· Enhancements to Silverlight out-of-browser capabilities which enable high quality application experiences on the desktop;

· Advancements in business application development, including access to other Microsoft products like SharePoint 2010, Office, and Internet Information Services (IIS);

· The most amazing HD-quality video experiences on the Web with native multicast and offline DRM support.

In addition, our list of customers and HD streaming events continues to grow, with 45 percent of Internet-connected devices worldwide using Silverlight. Today we highlighted the diverse ways Silverlight is being used to power the applications we use every day such as, Portland, OR startup SnapFlow, who demonstrated their new workflow-making platform. We’re also looking forward to helping NBC broadcast the 2010 Vancouver Winter Games in HD-quality video with Silverlight and IIS Smooth Streaming on NBCOlympics.com beginning February 12, 2010.

Drop by the PDC Virtual Pressroom to view Scott Guthrie’s keynote and to find out more information about Silverlight 4 beta. To download Silverlight 4 beta visit the Silverlight.net community site.

How To Export Data in a DataGrid on an ASP . NET WebForm to Microsoft Excel

  • Start Visual Studio .NET. On the File menu, point to New, and then click Project.
  • In the Project Types pane, click Visual Basic Projects. Under Templates, click ASP.NET Web Application. Name the application ExcelExport and then click OK.
    WebForm1 appears in Design view for you.
  • In Solution Explorer, right-click WebForm1.aspx and then click Rename. Change the name of the file to Bottom.aspx.
  • On the View menu, click HTML Source to add the following DataGrid between the < form > and < / form > tags:

    <asp:datagrid id="DataGrid1" runat="server" GridLines="Vertical" CellPadding="3" BackColor="White" BorderColor="#999999" BorderWidth="1px" BorderStyle="None" Width="100%" Height="100%" Font-Size="X-Small" Font-Names="Verdana"> <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#008A8C"></SelectedItemStyle> <AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle> <ItemStyle BorderWidth="2px" ForeColor="Black" BorderStyle="Solid" BorderColor="Black" BackColor="#EEEEEE"></ItemStyle> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" BorderWidth="2px" ForeColor="White" BorderStyle="Solid" BorderColor="Black" BackColor="#000084"></HeaderStyle> <FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle> <PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" Mode="NumericPages"></PagerStyle> </asp:datagrid>

  • On the View menu, click Design to return to design view.
    The DataGrid appears on the WebForm.
  • On the View menu, click Code to display the code behind the Web Form. Add the following code to the Page_Load event handler:

    Note You must change User ID <username> and password=<strong password> to the correct values before you run this code. Make sure that the user account has the correct permissions to perform this operation on the database.


    ' Create a connection and open it. Dim objConn As New System.Data.SqlClient.SqlConnection("User ID=<username>;Password=<strong password>;Initial Catalog=Northwind;Data Source=SQLServer;") objConn.Open() Dim strSQL As String Dim objDataset As New DataSet() Dim objAdapter As New System.Data.SqlClient.SqlDataAdapter() ' Get all the customers from the USA. strSQL = "Select * from customers where country='USA'" objAdapter.SelectCommand = New System.Data.SqlClient.SqlCommand(strSQL, objConn) ' Fill the dataset. objAdapter.Fill(objDataset) ' Create a new view. Dim oView As New DataView(objDataset.Tables(0)) ' Set up the data grid and bind the data. DataGrid1.DataSource = oView DataGrid1.DataBind() ' Verify if the page is to be displayed in Excel. If Request.QueryString("bExcel") = "1" Then ' Set the content type to Excel. Response.ContentType = "application/vnd.ms-excel" ' Remove the charset from the Content-Type header. Response.Charset = "" ' Turn off the view state. Me.EnableViewState = False
    Dim tw As New System.IO.StringWriter() Dim hw As New System.Web.UI.HtmlTextWriter(tw) ' Get the HTML for the control. DataGrid1.RenderControl(hw) ' Write the HTML back to the browser. Response.Write(tw.ToString()) ' End the response. Response.End()
    End If




  • NOTE: Replace SQLServer in the code with the name of your SQL Server. If you do not have access to a SQL Server that contains the Northwind sample database, modify the connection string to use the Microsoft Access 2002 sample Northwind database:

    provider=microsoft.jet.oledb.4.0; data source=C:\Program Files\Microsoft Office\Office10\Samples\Northwind.mdb

    If you select this method, modify the aforementioned code to use the OleDbClient namespace rather than the SqlClient namespace.

  • On the Project menu, click Add HTML Page. Name the page Top.htm and then click Open.
    Top.htm appears in Design view.
  • On the View menu, click HTML Source. Replace the contents of the HTML source window with the following code:

    <html> <script language="vbscript"> Sub Button1_onclick Select Case Select1.selectedIndex Case 0 ' Use Automation. Dim sHTML sHTML = window.parent.frames("bottom").document.forms(0).children("DataGrid1").outerhtml Dim oXL, oBook Set oXL = CreateObject("Excel.Application") Set oBook = oXL.Workbooks.Add oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML oBook.HTMLProject.RefreshDocument oXL.Visible = true oXL.UserControl = true Case 1 ' Use MIME Type (In a New Window). window.open("bottom.aspx?bExcel=1") Case 2 ' Use MIME Type (In the Frame). window.parent.frames("bottom").navigate "bottom.aspx?bExcel=1" End Select End Sub </script> <body> Export to Excel Using: <SELECT id="Select1" size="1" name="Select1"> <OPTION value="0" selected>Automation</OPTION> <OPTION value="1">MIME Type (In a New Window)</OPTION> <OPTION value="2">MIME Type (In the Frame)</OPTION> </SELECT> <INPUT id="Button1" type="button" value="Go!" name="Button1"> </body> </html>

  • On the Project menu, click Add HTML Page. Name the page Frameset.htm and then click Open.
    Frameset.htm opens in Design view.
  • On the View menu, click HTML Source. Replace the contents of the HTML source window with the following code:

    <html> <frameset rows="10%,90%"> <frame noresize="0" scrolling="no" name="top" src="top.htm"> <frame noresize="0" scrolling="yes" name="bottom" src="bottom.aspx"> </frameset> </html>

  • In Solution Explorer, right-click Frameset.htm and then click Set As Start Page.
  • On the Build menu, click Build Solution.
  • On the Debug menu, click Start Without Debugging to run the application.
    After the frameset opens in the Web browser, the DataGrid in the bottom frame displays the data from the Northwind database.
  • In the drop-down list, click Automation, and then click Go.
    The DataGrid contents are displayed outside the browser in the Microsoft Excel application window.
  • In the drop-down list, click MIME Type (In a New Window), and then click Go.
    The DataGrid contents are displayed in Excel hosted in a new Web browser window.
    NOTE: If you receive a prompt to open or save the Excel file, click Open.
  • In the drop-down list, click MIME Type (In the Frame) and then click Go.
    The DataGrid contents are displayed in the bottom frame of the frameset in Excel hosted in the Web browser.
    NOTE: If you receive a prompt to open or save the Excel file, click Open.

    enjoy……………………..

  • visual studio opens the browser at a different port than the development server runs at ?

    When You create a web site and try to debug it visual studio opens the browser at a different port than the development server runs at. When You try to run any project you receive "Page not found" in browser opened by ASP.NET Development server.

    here is its fix,

    as u have Eset nod32 antivirus v3.0.621 (same as me) , the problem is from this AV that dont allow connections to be made to Visual Studio ASP.NET Server .

    now follow these steps to solve this issue:

    1.DoubleClick on Nod32 icon on tray and Open it up.
    2.if it is not in "Advanced Mode" , switch to Advanced Mode. ( you can do it by clicking on the bottom-left link "Display:Standard Mode" and then click on "Toggle Advanced Mode" )
    3.then goto SETUP section. then on the Right Pane click on "Antivirus and Antispyware protection". the panel should be opened.
    4.now in the "Web Access protection" click on "Configure..."
    5.from the left Tree go to path : "Web access protection > HTTP > Web Browsers"
    6.now you should see visual studio 8 "devenv.exe" in the list .
    7.click on it twice till you see a cross sign in the box. ( Note on CROSS sign , not mark sign ! )
    8.with this cross sign you tell the Nod32 that this program should not be scanned and filtered for web access.
    due to this steps , my problem solved and now i can access my page from localhost: .

    ASP.Net Dynamic Data Web Site

    If your web site is heavily data driven then here is a quick and easy way for you to create one without writing much code. All you need is Visual Studio 2008 SP1 or Visual Web Developer 2008 Express SP1 installed on your box.

    Dynamic Data Web Sites makes use of a mechanism called Scaffolding. When Scaffolding is enabled it lets ASP.Net go through your data model and generate web pages for your tables. These generated pages have Insert, Delete and Update capabilities for each table.

    ASP.NET Dynamic Data Web Sites provides a framework that enables you to quickly build a functional data-driven application, based on a LINQ to SQL or Entity Framework data model. It also adds great flexibility and functionality to the DetailsView, FormView, GridView, and ListView controls in the form of smart validation and the ability to easily change the display of these controls using templates.

    ASP.NET Dynamic Data brings major usability and RAD development changes to the existing ASP.NET data controls. RAD development is significantly increased by the use of a rich scaffolding framework. After you add a LINQ to SQL or Entity Framework data model to a project, you can simply register it with Dynamic Data. The result is a fully functional Web site. Full CRUD (create, read, update, and delete) operations are supported. The site includes filtering by foreign keys and Boolean fields; foreign keys are automatically converted to their friendly names. Smart validation is automatically available, which provides validation based on database constraints for nullable fields, data type, and field length.

    The DetailsView and GridView controls have been extended to display fields by using templates instead of by using hard-coded rules that are programmed in the controls. These templates are part of the project, and you can customize them to change their appearance or to specify which controls they use for rendering. This makes it very easy to make a change in one place in your site that specifies how to present dates for editing, as one example. FormView and ListView controls can implement similar behavior by using a DynamicControl object in their templates and by specifying which field in the row to display. Dynamic Data will then automatically build the UI for these controls based on the templates that you specify.

    Validation is significantly improved in the controls as well. The controls read metadata for a LINQ to SQL or Entity Framework data model and provide automatic validation based on the model. For example, if a column in the database is limited to 50 characters, and if a column is marked as not nullable, a RequiredFieldValidator control is automatically enabled for the column. (The controls also automatically support data-model-level validation.) You can apply other metadata to take further control over display and validation.

    Here are some Links to start with :

    Getting Started with Dynamic Data

    Begin Modifying Dynamic Data Applications with URL Routing

    Begin Editing the Templates in ASP.NET Dynamic Data Applications

    Enable In-Line Editing in ASP.NET Dynamic Data Applications

    Or a blog post by Reshmi Mangalore at msdn bolgs


    Try this today and have fun!

    How to Create A Sliding Panel with Jquery

    We are going to show you a series of how to articles to create some jQuery effects with JavaScript in your web designs. In case you don’t know what jQeury is, it’s a JavaScript Library. It has heaps of Ajax and JavaScript components that will let you enhance your web design and the users experience on your site.

    First you need to grab a copy of jQuery Grab the latest released mini(compressed) version.

    How to get the elements you need.

    Creating jQuery Functions is relatively easy thank to the great documentation. The main thing you have to know is how to get the exact element that you want to apply the effects to.

    Example :


    * $(”#header”) = get the element with id=”header”
    * $(”h3″) = get all <h3> element
    * $(”div#content .photo”) = get all element with class=”photo” nested in the <div id=”content”>
    * $(”ul li”) = get all <li> element nested in all <ul>
    * $(”ul li:first”) = get only the first <li> element of the <ul>

    So with that in mind we are going to create our first jQuery effect. The commonly seen sliding panel, where you click a button and a panel slides up or down. Create a html document and call in the JavaScript file between the <head> tags along with you css file for styling. Then create two divs, one big one called <div id=”panel”></div> for the pannel and <div class=”btn-slide”></div> for the button. Style as you wish.

    Then call is javascript into your page either inline, or by an external .js file.






    When any element with in your html file is clicked, it will toggle the slide up and down of the <div id=”panel”> element and then toggle a CSS class=”active” to the <a class=”btn-slide”> element. The .active class will toggle the background position of the arrow image (by CSS).

    What is jquery

    jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.

    it's lightweight (just 19 kb in size) CSS3 complient and with cross browser support (IE 6.0+, FF 2+, Safari 3.0+, Opera 9.0+, Chrome and almost all the browsers).

    you can download the latest release from here

    Jquery API/1.3/Utilities

    API/1.3/Utilities

    From jQuery JavaScript Library

    Jump to: navigation, search

    Browser and Feature Detection:

    Name

    Type

    jQuery.support

    Returns: Object

    Added in jQuery 1.3 A collection of properties that represent the presence of different browser features or bugs.

    jQuery.browser

    Returns: Map

    Deprecated in jQuery 1.3 (see jQuery.support) Contains flags for the useragent, read from navigator.userAgent.

    jQuery.browser.version

    Returns: String

    Deprecated in jQuery 1.3 (see jQuery.support) The version number of the rendering engine for the user's browser.

    jQuery.boxModel

    Returns: Boolean

    Deprecated in jQuery 1.3 (see jQuery.support) States if the current page, in the user's browser, is being rendered using the W3C CSS Box Model.

    Array and Object operations:

    Name

    Type

    jQuery.each( object, callback )

    Returns: Object

    A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.

    jQuery.extend( deep, target, object1, objectN )

    Returns: Object

    Extend one object with one or more others, returning the modified object.

    jQuery.grep( array, callback, invert )

    Returns: Array

    Finds the elements of an array which satisfy a filter function. The original array is not affected.

    jQuery.makeArray( obj )

    Returns: Array

    Turns anything into a true array.

    jQuery.map( array, callback )

    Returns: Array

    Translate all items in an array to another array of items.

    jQuery.inArray( value, array )

    Returns: Number

    Determine the index of the first parameter in the Array (-1 if not found).

    jQuery.merge( first, second )

    Returns: Array

    Merge two arrays together.

    jQuery.unique( array )

    Returns: Array

    Remove all duplicate elements from an array of elements. Note that this only works on arrays of DOM elements, not strings or numbers.

    Test operations:

    Name

    Type

    jQuery.isArray( obj )

    Returns: Boolean

    Added in jQuery 1.3 Determine if the parameter passed is an array.

    jQuery.isFunction( obj )

    Returns: Boolean

    Determine if the parameter passed is a Javascript function object.

    String operations:

    Name

    Type

    jQuery.trim( str )

    Returns: String

    Remove the whitespace from the beginning and end of a string.

    URLs:

    Name

    Type

    jQuery.param( obj )

    Returns: String

    Serializes an array of form elements or an object (core of .serialize() method).