Infolink

 

Search This Blog

Showing posts with label Asp.Net Ajax. Show all posts
Showing posts with label Asp.Net Ajax. Show all posts

Oct 16, 2012

ASHX handler in Asp.Net

An ASHX handler allows you a discrete http handler without the overhead of processing a page request (an ASPX file).

<%@ WebHandler Language="C#" Class="Handler" %>

using System;
using System.Web;

public class Handler : IHttpHandler {
   
    public void ProcessRequest (HttpContext context) {
        var fileName = "must.sql";
        var r = context.Response;
        r.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
        r.ContentType = "text/plain";
        r.WriteFile(context.Server.MapPath(fileName));

    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}
 Now, You have to create button in your .aspx page write the code as following

<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />

protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("Handler.ashx");
    }
 

Oct 14, 2012

Spell as you Type plug-in

Full clientside spell checker for IE 6.0+ users that underlines misspellt words as you type into a textbox or textarea. Right click to see a list of suggested corrections.

Browsers such as Firefox and Chrome have spell as you type built in, this plugin will not have any effect in other browsers.

Use the dictionary supplied or create you own (plain text file, one word per line) using the dictionary builder application. The dictionaries supplied are over 500k each, so enable caching (and compression if available) on the server.

Creating a UserControl

we will be building a UserControl for displaying information about a community user.
First of all, let's add a UserControl to our project. In your Visual Studio or Visual Web Developer, you should be able to right click on your project and select Add new item.. A dialog will pop up, and you should select the Web User Control from the list of possible things to add. Let's call our UserControl UserInfoBoxControl, with the filename of UserInfoBoxControl.ascx. Make sure that you have checked the checkbox which places code in a separate file, the so-called CodeBehind file.

You should now have a UserInfoBoxControl.ascx and a UserInfoBoxControl.ascx.cs in your project. The first is where we put our markup, and the second is our CodeBehind file. Now, if UserInfoBoxControl.ascx is not already open and selected, do so now. You will see only one line of code, the UserControl declaration. As mentioned, this control will be displaying information about a user, so let's get started adding some markup to do so:

ASP.net Ajax

ASP.net Ajax is Microsoft's free framework for creating Ajax (Asynchronous Javascript and XML) web applications. At its simplest, it lets ASP developers do this - or add Ajax controls to their existing applications - without leaving their familiar drag-and-drop environment, and without having to understand Javascript or asynchronous communication with the host. According to the O'Reilly Network, it protects developers from "the underlying gibberish that makes it [Ajax] all work".
Related Posts Plugin for WordPress, Blogger...