Pages

Showing posts with label Web. Show all posts
Showing posts with label Web. Show all posts

Tuesday, 4 October 2011

Edit In Place Plugin Using jQuery

Edit In Place means : User clicks text on web page. Block of text becomes a form. User edits contents and presses submit button. Changes are sent via JavaScript which normally would be used to update the text and save it. Form becomes normal text again.

image

Demo using MVC Application:

1- First you must add jQuery , plugin and style sheet to _Layout.cshtml file.

<head>

    <title>@ViewBag.Title</title>

    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />

    <link href="../../StyleSheet.css" rel="stylesheet" type="text/css">

    <script src="@Url.Content("~/Scripts/jquery-1.6.4.js")" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/EditableText.js")" type="text/javascript"></script>

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>

    @RenderSection("head", required: false)

</head>

2- Pass the elements you want to make editable to the plugin. In this example I marked editable elements with "editableText" class.

<p class="editableText">

When you roll your cursor over the element , the background changes to a dashed darkorange line.

3- Looks for the div with id=”editableText” and tells jQuery to do something when the div is clicked. (Make the new line is not allowed )

jQuery(function ($) {
           $('p.editableText').editableText({
               newlinesEnabled: false
           });

           $.editableText.defaults.newlinesEnabled = true;

           $('div.editableText').editableText();

           $('.editableText').change(function () {
               var newValue = $(this).html();
           });
       });

Clicking the text will start some DOM (Document Object Model) magic resulting in the element being replaced by a textarea input — with the text to be edited inside.

In a real world application you would add in some additional safety checks, and then update your database with the new information and send back information that tells jQuery if the changes were successful.

4- Create a function that will do something with the new value of the editable element. Bind it to the element using change event. (Edit, Save and cancel events)

var editEl = buttons.find('.edit').click(function () {
                startEditing();
                return false;
            });

            buttons.find('.save').click(function () {
                stopEditing();
                editable.trigger(options.changeEvent);
                return false;
            });

            buttons.find('.cancel').click(function () {
                stopEditing();
                editable.html(prevValue);
                return false;
            });

check the “EditableText.js” file

 

See all the Demo code : Download

 

Useful Links :

- http://plugins.jquery.com/project/edit_in_place

- http://plugins.jquery.com/plugin-tags/edit-place


Thursday, 25 August 2011

Microsoft Web Platform Installer

Microsoft Web Platform Installed is a simple.

It’s a free tool that makes you can download and install all of Microsoft's entire web platform in one step using the Web Platform Installer’s user interface including :-

  1. IIS
  2. Visual Web Designer
  3. SQL Server 2008 Express Edition
  4. Microsoft .Net Framework
  5. Silverlight Tools
  6. and more ……

You can choose to install either specific products or the entire Microsoft Web Platform onto your computer.

The Web PI also helps keep your products up to date by always offering the latest additions to the Web Platform.

Web PI 1.0 supports Windows XP, Windows 2003, Windows Vista and of course Windows 2008.

Web PI 3.0 supports Windows 7, Windows Vista SP2, Windows XP SP3+, Windows Server 2003 SP2+, Windows Server 2008, Windows Server 2008 R2.

Download Web PI 3.0

Web PI starts up on the "Spotlight" tab, where we highlight products and applications that we think will be the most interesting for our users

web-platform-installerFigure 1: “Web PI Spotlight” tab

 

Web PI separates the components you can install into two main categories:  Products and Applications.

In the Products tab, you will find all the components you need to build and maintain your web sites.  The Applications tab is home to our wide collection of open-source applications that you can use as a great starting place for developing your sites.

 

The “Products” tab shows the four main components: Server, Frameworks, Database and Tools.

IC477051

Figure 2: “Products” tab