Top 10 Characteristics Of A Good Website

A website is a public application that usually targets any number of users. If you’re building a website, you want to make sure you build something that is likeable and usable. In this article, I talk about top 10 characteristics a good website must possess.

Functional

A website is designed to serve a purpose, usually to solve a problem. For example, a job board has a purpose where employers can post jobs and job seekers can find and apply for jobs. Once applied, there should be a way for candidates and employers to communicate and keep up to date with a job application. If you build a job board and it only lets you post jobs, that’s not enough.

Easiness

A website should be easy to use and navigate. When users visit your website, do they find the information they are looking for, without struggling? Does your website provide easy navigation to jump from one page to another and go back?

Relevant Content

You do not want to put content on a website that is not relevant to the users. You do not want to put car details on a job board. If your website is a job board, it should have content and tips related to being a good candidate such as how to create a professional resume and how to behave in an interview. You do not want to post about cars or sports on a job board.

Modern

You want to make sure your website is using current trends and technologies. You do not want to build a website that does not support today’s needs. For example, responsiveness and fluid web designs are the key requirements for modern websites. You do not want to create fixed page layouts for your website that doesn’t support mobile readability.

Optimized

Your website and its content should be optimized for different devices, browsers, data speed, search engines, and users. If your website is not optimized for mobile data users and their download speed, users may leave your website. If your website does not support common modern browsers, you may be missing out on some users. If your website is not optimized for popular smartphones and their sizes, users may not want to visit your website.

Responsive

Responsive web design is a modern need. A responsive website changes its layout and options to fit the device and browser size. For example, a website may provide more options on a large PC monitor compared to on a mobile phone.

Performance and Speed

Does your website load fast enough to show visitors what they are looking for? Your website can’t be slow when presenting content to its visitors. If your website takes more than two seconds to load, it is probably too slow.

Reliable

Is your website reliable? If I apply for a job, does your website send me on-time notifications and messages to keep me posted with the updates? Can I access your website whenever and wherever? Is your website up and running 24/7?

Scalable

Do you have sufficient infrastructure to support your website and its visitors? A website should be able to scale to a number of potential visitors. Not only should the website’s user interface be scalable but the back-end database, APIs, and services too should be able to scale.

Secure

Security is a major concern to today’s web visitors. You need to make sure that your website follows industry standards and guidelines. For example, if you have user registration feature, you want to make sure that user passwords are encrypted and not displayed in plain text. You also want to ensure that the website is secure and uses SSL encryption. If you’ve forgotten a password feature, you do not want to provide a reset password feature without asking the security questions to the user.

LINK: http://www.c-sharpcorner.com/article/top-10-characteristics-of-a-good-website/

Advertisements

Nén GZIP cho Website ASP.NET và ASP.NET MVC

Chào mọi người!
Hôm nay ngồi kiểm tra lại phần dữ liệu trả về của trang lộ trình và trang giám sát online thì mình đã có một số kinh nghiệm, muốn chia sẻ lại với các bạn.
1. Trang lộ trình
– Trước khi chỉnh lại, khi xem 1 xe dữ liệu trả về là: 5,8 MB
– Sau khi chỉnh lại, dữ liệu trả về chỉ còn: 159 KB => giảm tới 36 lần, 1 con số giật mình
2. Trang online
– Trước khi chỉnh lại, dữ liệu trả về 1 phiên thường là 600KB
– Sau khi chỉnh lại, dữ liệu trả về 1 phiên chỉ còn: khoảng 35KB => giảm tới 17 lần.
3. Kỹ thuật để giảm tải dữ liệu trả về
– Dữ liệu bên mình làm việc chủ yếu là JSON, khi đặt tên thuộc tính mà dài thì tên của key còn nhiều hơn cả value => mình đã chỉnh lại tên khi JSON trả về ngắn nhất có thể
+ Dữ liệu trước khi giảm
{
"Time":"\/Date(1454605200000)\/",
"Lat":21.008797,
"Lng":105.854355,
"LatLng":"21,008797, 105,854355",
"CustomerNumber":1,
"VelocityGPS":14,
"VBgt":14,
"Eyestatus":true,
"EyestatusStr":null,
"Speedometer":14,
"AccumulatedKm":0,
"IsOverSpeed":false,
"IsLostGPS":false,
"IsLostGSM":false,
"IsStoped":false,
"IsHasGuest":true,
"IsMachineOff":false,
"MachineOffText":"Bật",
"IsAirConditionerOn":false,
"AirConditionerOnText":"Tắt",
"Message":"Có khách",
"Color":"Blue",
"TotalKm":8.54,
"TotalKmHasGuest":0.73,
"HasGuestStr":null,
"Address":null,
"TotalMachineOnMinute":23,
"TotalACOnMinute":0,
"RowNumber":0,
"VehicleID":null,
"VehiclePlate":null,
"PrivateCode":null,
"CompanyID":0,
"VehicleModel":null,
"VehicleSeat":0,
"VehicleType":"",
"ObjectState":0
}

+ Dữ liệu sau khi giảm

{
"p1":"\/Date(1454605200000+0700)\/",
"p2":14,
"p3":14,
"p4":0.0,
"p5":21.008797,
"p6":105.854355,
"p7":14.0,
"p8":1,
"p9":"Có khách",
"p10":"Blue",
"p11":null,
"p12":33,
"p13":"68,27;39,99;304;",
"p14":true
}

+ Như các bạn đã thấy, mình đã chuyển tên các thuộc tính về ngắn nhất có thể, và các giá trị dạng bool mình đã gom lại cho p12 (dạng Flags và mình sẽ dùng bitwise ở phía client để giảm tải dữ liệu đi về.)
+ Với cách cắt giảm như trên thì mình đã tiết kiệm dữ liệu từ 5,7MB xuống còn 1,4MB (Giảm khá nhiều, nhưng cần thêm 1 lần nữa để giảm triệt để hơn)
– Bật chức năng GZIP có sẵn trong ASP.NET để giảm kích thước trả về
+ Thực ra đây là phần có sẵn của ASP.NET, mình chỉ cần khai báo 1 ít trong Global.asax là có thể giảm khá nhiều.
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
string acceptEncoding = app.Request.Headers["Accept-Encoding"];
System.IO.Stream prevUncompressedStream = app.Response.Filter;

if (acceptEncoding == null || acceptEncoding.Length == 0)
return;

acceptEncoding = acceptEncoding.ToLower();

if (acceptEncoding.Contains(“gzip”))
{
// gzip
app.Response.Filter = new System.IO.Compression.GZipStream(prevUncompressedStream,
System.IO.Compression.CompressionMode.Compress);
app.Response.AppendHeader(“Content-Encoding”,
“gzip”);
}
else if (acceptEncoding.Contains(“deflate”))
{
// defalte
app.Response.Filter = new System.IO.Compression.DeflateStream(prevUncompressedStream,
System.IO.Compression.CompressionMode.Compress);
app.Response.AppendHeader(“Content-Encoding”,
“deflate”);
}
}

+ Sau khi khai báo GZIP, dữ liệu của mình từ 1,4 MB => 159 KB (Giảm khoảng gần 9 lần)
– 1 số link tham khảo
+ http://thuyvk.com/article/su-dung-nen-gzip-cho-website-aspnet-178
+ http://checkgzipcompression.com/

IIS Crash – những lưu ý khi sử dụng đệ quy trong C#

Chào mọi người.
– Hiện tại mình hay dùng đệ quy cho các phần hay làm như các phần về cây: cây nhóm đội, cây công ty vv.
– Trong trường hợp đẹp thì việc sử dụng đệ quy không có vấn đề gì.
+ Hôm nay mình gặp trường hợp chạy IIS toàn bị Crash mà không biết nguyên nhân tại sao.

Log Name: Application
Source: Application Error
Date: 11/17/2015 4:11:35 PM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: BASRV35.ba.vn
Description:
Faulting application name: w3wp.exe, version: 8.5.9600.16384, time stamp: 0x5215df96
Faulting module name: clr.dll, version: 4.0.30319.34209, time stamp: 0x5348a1ef
Exception code: 0xc00000fd
Fault offset: 0x00000000000056a4
Faulting process id: 0x9c30
Faulting application start time: 0x01d12117d7418b09
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Report Id: 32cccab2-8d0b-11e5-80c6-002590d58429
Faulting package full name:

+ Sau khi google thì mình tìm được 1 bài có mô tả Event 0xc00000fd is a StacokOverflowException)
(+) http://stackoverflow.com/questions/17189522/iis-crash-on-stack-overflow-unhandled-microsoft-net-4-5-asp-net-mvc-3
VD: Code trước khi chỉnh sửa

public class RecuriveBefore
{
public void Recursive(int value, int level)
{
try
{

// Write call number and call this method again.
// … The stack will eventually overflow.
Console.WriteLine(value);
Recursive(++value, level + 1);

}
catch (StackOverflowException ex)
{
Console.WriteLine(“Exception: {0}”, ex.Message);
}
}
}
class Program
{
static void Main()
{
// Begin the infinite recursion.
RecuriveBefore recursiveBefore = new RecuriveBefore();
//recursiveBefore.Recursive(0, 0);

Console.ReadLine();
}
}

– Chỉnh lại với các hàm đệ quy
+ Thêm 1 biến để quản lý số lần gọi đệ quy của 1 Method
+ Khi quá số lần max thì thoát luôn hàm đệ quy, nếu không thì lỗi StackOverflowException xuất hiện, mà khi lỗi này xuất hiện thì apps tèo rồi.
VD: Code sau khi chỉnh sửa

public class RecuriveAfter
{
private int MaxDepth = 2000;

public void Recursive(int value, int level)
{
try
{
if (level < MaxDepth)
{
// Write call number and call this method again.
// … The stack will eventually overflow.
Console.WriteLine(value);
Recursive(++value, level + 1);
}
else
{
Console.WriteLine(“Level:” + level);
Console.WriteLine(“Exit Recursive.”);
}
}
catch (StackOverflowException ex)
{
Console.WriteLine(“Exception: {0}”, ex.Message);
}
}
}
class Program
{
static void Main()
{
RecuriveAfter recursiveAfter = new RecuriveAfter();
recursiveAfter.Recursive(0, 0);

Console.ReadLine();
}
}

SignalR Database update notifications in ASP.NET MVC using SQL Dependency

In this we will learn how to display real time updates from the  SQL Server  by using SignalR  and SQL Dependency in ASP.NET MVC. You can download the source from the Github The following are the steps that we need to enable in the SQL Server first. Step 1: Enable Service Broker on the database The

In this we will learn how to display real time updates from the  SQL Server  by using SignalR  and SQL Dependency in ASP.NET MVC.

You can download the source from the Github

The following are the steps that we need to enable in the SQL Server first.

Step 1: Enable Service Broker on the database

The following is the query that need to enable the service broker

ALTER DATABASE BlogDemos SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE ;

Step 2: Add Connection string to the Web.Config file

<add name=&rdquo;DefaultConnection&rdquo; connectionString=&rdquo;Server=servername;Database=databasename;User Id=userid;Password=password;&rdquo; providerName=&rdquo;System.Data.SqlClient&rdquo; />

Step 3: Enable SQL Dependency

In Global.asax start the SQL Dependency in App_Start() event and Stop SQL dependency in the Application_End() event

public class MvcApplication : System.Web.HttpApplication
    {
        string connString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            GlobalConfiguration.Configure(WebApiConfig.Register);
            //Start SqlDependency with application initialization
            SqlDependency.Start(connString);
        }

        protected void Application_End()
        {
            //Stop SQL dependency
            SqlDependency.Stop(connString);
        }
    }

Step 4: Install SignalR from the nuget

Run the following command in the Package Manager Console

Install-Package Microsoft.AspNet.SignalR

Step 5: Create SignalR Hub Class

Create MessagesHub class in the Hubs folder

public class MessagesHub : Hub
    {
        private static string conString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();
        public void Hello()
        {
            Clients.All.hello();
        }

        [HubMethodName("sendMessages")]
        public static void SendMessages()
        {
            IHubContext context = GlobalHost.ConnectionManager.GetHubContext<MessagesHub>();
            context.Clients.All.updateMessages();
        }

        
    }

 Step 6: Get the  Data from the Repository

Create MessagesRepository to get the messages from the database when data is updated.

public class MessagesRepository
    {
        readonly string _connString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

        public IEnumerable<Messages> GetAllMessages()
        {
            var messages = new List<Messages>();
            using (var connection = new SqlConnection(_connString))
            {
                connection.Open();
                using (var command = new SqlCommand(@"SELECT [MessageID], [Message], [EmptyMessage], [Date] FROM [dbo].[Messages]", connection))
                {
                    command.Notification = null;

                    var dependency = new SqlDependency(command);
                    dependency.OnChange += new OnChangeEventHandler(dependency_OnChange);

                    if (connection.State == ConnectionState.Closed)
                        connection.Open();

                    var reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        messages.Add(item: new Messages { MessageID = (int)reader["MessageID"], Message = (string)reader["Message"], EmptyMessage =  reader["EmptyMessage"] != DBNull.Value ? (string) reader["EmptyMessage"] : "", MessageDate = Convert.ToDateTime(reader["Date"]) });
                    }
                }
              
            }
            return messages;
           
            
        }

        private void dependency_OnChange(object sender, SqlNotificationEventArgs e)
        {
            if (e.Type == SqlNotificationType.Change)
            {
                MessagesHub.SendMessages();
            }
        }
    }

Step 7:  Register SignalR at startup class

Add the following code

app.MapSignalR();

Step 8:  View Page

Create div messagesTable that will append the table data from the database

<div class="row">
    <div class="col-md-12">
       <div id="messagesTable"></div>
    </div>
</div>

Now Add the SignalR related scripts in the page.

getAllMessages is a function that return the partialview data and bind it into the messagesTable div.
<script src="/Scripts/jquery.signalR-2.1.1.js"></script>
 <!--Reference the autogenerated SignalR hub script. -->
    <script src="/signalr/hubs"></script>

<script type="text/javascript">
    $(function () {
        // Declare a proxy to reference the hub.
        var notifications = $.connection.messagesHub;
       
        //debugger;
        // Create a function that the hub can call to broadcast messages.
        notifications.client.updateMessages = function () {
            getAllMessages()
           
        };
        // Start the connection.
        $.connection.hub.start().done(function () {
            alert("connection started")
            getAllMessages();
        }).fail(function (e) {
            alert(e);
        });
    });


    function getAllMessages()
    {
        var tbl = $('#messagesTable');
        $.ajax({
            url: '/home/GetMessages',
            contentType: 'application/html ; charset:utf-8',
            type: 'GET',
            dataType: 'html'
        }).success(function (result) {
            tbl.empty().append(result);
        }).error(function () {
            
        });
    }
</script>

Step 9 : Create Partial View Page

Create a partial view _MessagesList.cshtml that returns all the messages.

@model IEnumerable<SignalRDbUpdates.Models.Messages>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="table">
    <tr>
        <th>@Html.DisplayNameFor(model => model.MessageID)</th>
        <th>
            @Html.DisplayNameFor(model => model.Message)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.EmptyMessage)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.MessageDate)
        </th>
        
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.MessageID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Message)
        </td>
        <th>
            @Html.DisplayFor(modelItem => item.EmptyMessage)
        </th>
        <td>
            @Html.DisplayFor(modelItem => item.MessageDate)
        </td>
        
    </tr>
}

</table>

Step 10: Set Up the Database

Create the database called blogdemos and run the following script

USE [BlogDemos]
GO

/****** Object:  Table [dbo].[Messages]    Script Date: 10/16/2014 12:43:55 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Messages](
	[MessageID] [int] IDENTITY(1,1) NOT NULL,
	[Message] [nvarchar](50) NULL,
	[EmptyMessage] [nvarchar](50) NULL,
	[Date] [datetime] NULL,
 CONSTRAINT [PK_Messages] PRIMARY KEY CLUSTERED 
(
	[MessageID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Messages] ADD  CONSTRAINT [DF_Messages_Date]  DEFAULT (getdate()) FOR [Date]
GO

Step 11: Run the project

When eve data is inserted into the table the dependency_OnChange method will fire.

Source Code

You can download the source from the Github

LINK: http://www.codeproject.com/Articles/874240/SignalR-Database-update-notifications-in-ASP-NET-M

Introduction to SignalR

Introduction

This article gives you a basic idea about the new developer’s API called “SignalR”.

Background

In earlier ASP.NET applications, user refreshes a web page to see new data or a page uses “long polling” to retrieve new data, i.e., when new data arrives to server it will not be directly transmitted to all clients or specific clients, for that the user has to refresh the page, and the page will be updated.

For example, you can go to cricinfo.com, there you can see a page is refreshed for 1 or 2 seconds and many times you see the score is not updated. In such situations there is the need of the new Microsoft API called “SignalR”.

What is SignalR

SignalR is a new developer’s API provided for ASP.NET web applications, used to add “real time” web functionality to ASP.NET applications. “Real Time” web functionality is the ability to have server code to push contents to connected clients.

SignalR supports “server push” or “broadcasting” functionality. It handles connection management automatically. In classic HTTP connections for client-server communication connection is re-established for each request, but SignalR provides persistent connection between the client and the server. In SignalR the server code calls out to a client code in the browser using Remote Procedure Calls (RPC), rather than request-response model today. SignalR is an open-source API, and is accessible through GitHub.

Where to use:

  1. Chat room applications
  2. Real-time monitoring applications
  3. Job progress updates
  4. Real time forms

You can see the use of SignalR for a chat room application in the following image:

In the above example as soon as user2 sends some message, it will be received by all other users.

API Details

SignalR provides two models for communication:

    1. Persistent Connections

The Persistent Connection API gives developer direct access to the low level communication protocol that SignalR exposes. This API uses the format of the actual message sent that needs to be specified and if the developer prefers to work with messaging and dispatching model rather than a remote invocation.

    1. Hubs:

It’s a High Level API written over PersistentConnection. This API allows the client and server to call methods on each other directly. Hubs also allow you to pass strongly typed parameters to methods, enabling model binding.

Code

Steps:

    1. Open Visual Studio 2010.
    2. Create a new project, select ASP.NET Empty Web Application and name it ‘ChatRoomApplication’.
    3. Go to Tools and open Package Manager Console.
    4. If you don’t have a Nuget package manager console then download it. For that go to Tools–>Extension Manager, and in the Search textbox, enter ‘NuGet Package Manager’, and download it.
    5. Open Package Manager console (Tools –> Library Package Manager –> Package Manager Console).
    6. Give command ‘Install-Package Microsoft.AspNet.SignalR’.
    7. It will add references of SignalR DLLs to your application.
    8. In Solution Explorer right click on ChatRoomApplication and add class “ChatHub”. A ChatHub.cs file will be added.
    9. Derive the ChatHub class from ‘Hub‘. It should look like:
 Collapse | Copy Code
public class ChatHub : Hub
{
}

Write method Send in the ChatHub class as:

 Collapse | Copy Code
public class ChatHub : Hub
{
    public void Send(string name, string message)
    {
        Clients.All.sendMessage(name,message);
    }
}
    1. Now add the Global.asax file to your application. And in the application_start event map your hub byRouteTable.Routes.MapHubs(). It should look like:
 Collapse | Copy Code
protected void Application_Start(object sender,EventArgs e)
{
    RouteTable.Routes.MapHubs();
}
    1. Now add an ASPX page and name it default.aspx
    2. Copy the following code in the <head></head> section:
 Collapse | Copy Code
<script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.signalR-1.0.1.min.js" type="text/javascript"></script>
<script src="signalr/hubs" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        // Proxy created on the fly          
        var chat = $.connection.chatHub;

        // Get the user name and store it to prepend to messages.
        $('#displayname').val(prompt('Enter your name:', ''));

        // Declare a function on the chat hub so the server can invoke it          
        chat.client.sendMessage = function (name, message) {
			var encodedName = $('<div />').text(name).html();
			var encodedMsg = $('<div />').text(message).html();
			$('#messages').append('<li>' + encodedName + 
			    ':  ' + encodedMsg + '</li>');
        };

        // Start the connection
        $.connection.hub.start().done(function () {
            $("#send").click(function () {
                // Call the chat method on the server
                chat.server.send($('#displayname').val(), $('#msg').val());
            });
        });
    });
</script>
    1. Copy the following code into the <body> part:
 Collapse | Copy Code
<div>
<input type="text" id="msg" />
<input type="button" id="send" value="Send" />
<input type="hidden" id="displayname" />
<ul id="messages">
</ul>
</div>
  1. That’s it, now run your application, open multiple instances of the browser and copy the same URL there…and type message in the text box, click on the Send button, and you can see the message will be displayed on all browsers.
  2. For more information, look at the submitted code.

LINK: http://www.codeproject.com/Tips/590660/Introduction-to-SignalR

Ajax Control Toolkit ModalPopup

The ModalPopup extender allows you to display content in an element that mimics a modal dialog box, which prevents the user from interacting with the rest of the page. The modal content can contain any hierarchy of controls. It is displayed above a background (in z-order) that can have a custom style applied to it.

Clicking OK or Cancel in the modal popup dismisses the content and optionally runs custom script. The custom script is typically used to apply changes that were made in the modal popup. If a postback is required, you can allow the OK or Cancel control to perform the postback.

By default, the modal content is centered on the page. However, you can set absolute positiniong, and set only X or only Y to center the content vertically or horizontally.

ModalPopup Server Reference

The properties in italics are optional.

  1. <ajaxToolkit:ModalPopupExtender ID=”MPE” runat=”server”
  2.     TargetControlID=”LinkButton1″
  3.     PopupControlID=”Panel1″
  4.     BackgroundCssClass=”modalBackground”
  5.     DropShadow=”true”
  6.     OkControlID=”OkButton”
  7.     OnOkScript=”onOk()”
  8.     CancelControlID=”CancelButton”
  9.     PopupDragHandleControlID=”Panel3″ />
  • TargetControlID – The ID of the element that activates the modal popup.
  • PopupControlID – The ID of the element to display as a modal popup.
  • BackgroundCssClass – The CSS class to apply to the background when the modal popup is displayed.
  • DropShadow – True to automatically add a dropshadow to the modal popup.
  • OkControlID – The ID of the element that dismisses the modal popup.
  • OnOkScript – The script to run when the modal popup is dismissed using the element specified in OkControlID.
  • CancelControlID – The ID of the element that cancels the modal popup.
  • OnCancelScript – The script to run when the modal popup is dismissed using the element specified in CancelControlID.
  • PopupDragHandleControlID – The ID of the embedded element that contains the popup header and title that will be used as a drag handle.
  • X – The X coordinate of the top left corner of the modal popup. If this value is not specified, the popup will be centered horizontally.
  • Y – The Y coordinate of the top left corner of the modal popup. If this value is not specified, the popup will be centered vertically.
  • RepositionMode – A value that determines whether the popup must be repositioned when the window is resized or scrolled.

ModalPopup Client Reference

Sys.Extended.UI.ModalPopupBehavior Class

  • Summary – Displays the target element as a pop-up modal dialog box.
  • Parameters – Sys.UI.DomElement element

 

Events

  • showing(handler) – Adds or removes an event handler for the showing event.
    • Parameters – A function that represents the event handler.
  • shown(handler) – Adds or removes an event handler for the shown event.
    • Parameters – A function that represents the event handler.
  • hiding(handler) – Adds or removes an event handler for the hiding event.
    • Parameters – A function that represents the event handler.
  • hidden(handler) – Adds or removes an event handler for the hidden event.
    • Parameters – A function that represents the event handler.

 

Methods

  • initialize() – Initializes the ModalPopup behavior.
  • dipose() – Disposes the ModalPopup behavior.
  • show() – Displays the element that is referenced by the PopupControlID property as a modal dialog box.
  • disableTab() – Changes the tab indexes so that tabbing moves the focus only through the modal dialog box.
    • Remarks – In Internet Explorer 6, the disableTab method also hides the select elements.
  • restoreTab() – Restores the tab indexes from the page.
    • Remarks – In Internet Explorer 6, the restoreTab method also restores the select elements.
  • hide() – Hides the modal popup.
    • Returns – Returns a Boolean value that specifies whether the popup was hidden.
  • raiseShowing(Sys.EventArgs) – Raises the showing event.
    • Parameters – A Sys.EventArgs object that represents arguments for the showing event.
  • raiseShown(Sys.EventArgs) – Raises the shown event.
    • Parameters – A Sys.EventArgs object that represents arguments for the shown event.
  • raiseHiding(Sys.EventArgs) – Raises the hiding event.
    • Parameters – A Sys.EventArgs object that represents arguments for the hiding event.
  • raiseHidden(Sys.EventArgs) – Raises the hidden event.
    • Parameters – A Sys.EventArgs object that represents arguments for the hidden event.
  • Sys.Extended.UI.ModalPopupBehavior.invokeViaServer(behaviorID, show) – Shows or hides the behavior that is associated with behaviorID. This method is intended to be called from script that is emitted in server code.
    • Parameters – String behaviorID, Boolean show.
    • Remarks – To use this static method, the ModalPopupExtender instance must have its ID or its BehaviorID property set. The method shows or hides the behavior depending on the show parameter.

 

Properties

  • PopupControlID – Gets or sets the ID of the element to display as a modal popup.
  • X – Gets or sets the distance, in pixels, from the left side of the modal popup to the left border of the browser window.
  • Y – Gets or sets the distance, in pixels, from the top side of the modal popup to the top border of the browser window.
  • PopupDragHandleControlID – Gets or sets the ID of the element to display as the drag handle for the modal popup.
  • BackgroundCssClass – Gets or sets the CSS class to apply to the background when the modal popup is displayed.
  • DropShadow – Gets or sets a Boolean value that specifies whether a dropshadow should be added to the modal popup.
  • Drag – Gets or sets a Boolean value that specifies whether the modal popup can be dragged.
    • Remarks – OBSOLETE.
  • OkControlID – Gets or sets the ID of the element that dismisses the modal popup.
  • CancelControlID – Gets or sets the ID of the element that cancels the modal popup.
  • OnOkScript – Gets or sets the script to run when the modal popup is dismissed by the element specified using the OkControlID property.
  • OnCancelScript – Gets or sets the script to run when the modal popup is dismissed by the element specified using the CancelControlID property.
  • repositionMode – Gets or sets a Sys.Extended.UI.ModalPopupRepositionMode object that determines whether the modal popup should be repositioned on window resize or on window scroll.

 

Sys.Extended.UI.ModalPopupRepositionMode Enum

  • Summary – Describes how the modal popup can be repositioned.

 

Fields

For

  • None – A field that specifies the modal popup reposition action.
  • RepositionOnWindowResize – A field that specifies the modal popup reposition action.
  • RepositionOnWindowScroll – A field that specifies the modal popup reposition action.
  • RepositionOnWindowResizeAndScroll – A field that specifies the modal popup reposition action.

Link gốc: http://www.asp.net/ajaxlibrary/act_modalpopup.ashx

Real Time Web Solution for Chat by MVC SignalR Hub

Bài viết giới thiệu cơ bản về các cơ chế làm việc giữa client và server

1. WebSocket

–  Simplex Communication

– Half duplex

2. Server Sent Events (SSE)
3. Forever Frame
4. Polling

– Client (Request), Server (Response)
5. Long Polling (Keep Connection)

–  Persistentconnection

– Hub

Link chi tiết: http://www.codeproject.com/Articles/732190/Real-Time-Web-Solution-for-Chat-by-MVC-SignalR-H