Categories
Work

Avro Phonetic Web User Control for ASP.NET

The idea is pretty simple: A web user control for ASP.NET that loads the Avro Phonetic keyboard and binds the text inputs and text areas.

The control can be downloaded from: http://masnun.googlecode.com/files/Avro.zip

How to use it?

1) Extract Avro.zip and you shall get two files in the Avro folder: “Avro.ascx” and “Avro.ascx.cs”. First one is the user control and second one is the codebehind file.

2) Crate a new website project in Visual Studio or open your existing project.

3) Copy the above mentioned two files (NOT the entire directory, just the files) into your project. For better organization you might want to create a “Controls” directory (if you haven’t already). Paste the two files inside your desired directory.

4) Now, we add the controls to a web form. Open a page, say Default.aspx. Just below the Page directives, add the following Register directives to register the control:

<%@ Register Src="~/Controls/Avro.ascx" TagPrefix="asp" TagName="Avro" %>

Here, Src is the location to the Avro.ascx file. TagPrefix and TagName makeup the custom tag that loads the control. In this case, you now have a <asp:Avro> tag which you can use to load the control.

5) Let’s add the control:


The control accepts two attributes – “Bangla” and “Callback”. Setting Bangla to “true” or “false” enables or disables Bangla by default. The Callback attribute accepts the name of a Javascript function which is called when the keyboard state changes.

6) Let’s test the control by adding a text area and the defined callback function:


    

Load the web page in your browser. If you have Firebug installed in Firefox, the callback should print out state of the Bangla layout on the console.

For brevity, here is my entire Default.aspx file:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Src="~/Controls/Avro.ascx" TagPrefix="asp" TagName="Avro" %>



    
    
    

3 replies on “Avro Phonetic Web User Control for ASP.NET”

Comments are closed.