.NET to Javascript compiler

C# code   Html page   Start
public class DropDownApp
{
    public static void Start()
    {
        InitDropDowns();
    }

    internal static void InitDropDowns()
    {
        InitComboBox();
        InitTreeDropDown();
        InitGridDropDown();
    }
    static void InitComboBox()
    {
        NumericTextBox numeric = new NumericTextBox(
            (HtmlInputText)HtmlDocument.Current.GetElementById("numericTextBoxFlat"), 
            true, 
            0, 
            false);

        NodeSource nodeSource = new NodeSource(1, 1000);

        HtmlElement outputValue = HtmlDocument.Current.GetElementById("valueFlat");
        ListBox listBox = new ListBox() {
            DataSource = nodeSource,
            Renderer = MultiSelectionApp.CreateRenderer().Render
        };

        IEditor<long?> editor = numeric;

        listBox.Selection.AdviseClick(delegate()
        {
            Node node = (Node)listBox.Selection.Data;
            if (node == null)
            {
                editor.Value = null;
            }
            else
            {
                long value = node.Start + node.Count;
                editor.Value = value;
            }
        });

        numeric.Advise(delegate()
        {
            outputValue.InnerText = string.Format("{0:N0}", numeric.Value);
        });

        new ComboBox<NumericTextBox, long?>(numeric, listBox)
        {
            IndexSearcher = nodeSource.SearchIndex
        };
    }

    static void InitTreeDropDown()
    {
        NumericTextBox numeric = new NumericTextBox((HtmlInputText)HtmlDocument.Current.GetElementById("numericTextBoxHierarchy"));
        HtmlElement outputValue = HtmlDocument.Current.GetElementById("valueHierarchy");
        NodeSource nodeSource = new NodeSource();
        TreeView treeView = new TreeView()
        {
            NodeClassName = "treeNodeWin7-20",
            NodeSource = nodeSource,
            Renderer = TreeViewApp.Render
        };

        numeric.Advise(delegate()
        {
            if (treeView.Selection.Index < 0 
                || ((IObservableHierarchyList)treeView.Selection.Nodes.List)[treeView.Selection.Index] == null)
            {
                numeric.Element.Style.BackgroundImage = string.Empty;
            }
            else
            {
                numeric.Element.Style.BackgroundImage = "images/folderWin7.gif";
            }
        });

        IEditor<long?> editor = numeric;

        treeView.Selection.AdviseClick(delegate()
        {
            Node node = (Node)treeView.Selection.Data;
            if (node == null)
            {
                editor.Value = null;
            }
            else
            {
                long value = node.Start + node.Count;
                editor.Value = value;
            }
        });

        numeric.Advise(delegate()
        {
            outputValue.InnerText = string.Format("{0:N0}", numeric.Value);
        });

        new TreeViewComboBox<NumericTextBox, long?>(numeric, treeView)
        {
            PathSearcher = nodeSource.SearchPath
        };
    }

    static void InitGridDropDown()
    {
        NumericTextBox numeric = new NumericTextBox((HtmlInputText)HtmlDocument.Current.GetElementById("numericTextBoxGrid"), true, 0, false);
        HtmlElement outputValue = HtmlDocument.Current.GetElementById("valueGrid");
        DataSource dataSource = new DataSource(0, 1000);

        Grid grid = new Grid();
        GridApp.InitGrid(grid);
        grid.Header.Visible = false;
        grid.RowsSelection.AllowMultipleRowSelection = false;
        grid.DataSource = dataSource;

        IEditor<long?> editor = numeric;

        grid.RowsSelection.AdviseClick(delegate()
        {
            if (grid.RowsSelection.FocusedRow < 0)
            {
                editor.Value = null;
            }
            else
            {
                long value = (long)((IObservableList)dataSource)[grid.RowsSelection.FocusedRow];
                editor.Value = value;
            }
        });

        numeric.Advise(delegate()
        {
            outputValue.InnerText = string.Format("{0:N0}", editor.Value);
        });

        new GridComboBox<NumericTextBox, long?>(numeric, grid)
        {
            IndexSearcher = dataSource.SearchIndex
        };
    }
}

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
    <meta http-equiv="x-ua-compatible" content="IE=11;IE=10;IE=9;IE=8;IE=7" />
    <link rel="stylesheet" href="styles/jscriptsuite.css" type="text/css" />
    <link rel="stylesheet" href="styles/summary.css" type="text/css" />
  <script type="text/javascript" src="js/dropdown.js?v1"></script>
  </head>
	<body onload="StartScript()">
    DropDown.html
    <table cellpadding="2" cellspacing="0">
          <tr>
              <th></th>
              <th>Flat</th>
              <th>Hierarchy</th>
              <th>Grid</th>
          </tr>
          <tr>
              <td>Picker</td>
              <td>
                <input type="text" style="width:100px" id="numericTextBoxFlat"/>
              </td>
              <td>
                <input type="text" style="width:100px" id="numericTextBoxHierarchy"/>
              </td>
              <td>
                <input type="text" style="width:100px" id="numericTextBoxGrid"/>
              </td>
          </tr>
          <tr>
              <td>Value</td>
              <td id="valueFlat"></td>
              <td id="valueHierarchy"></td>
              <td id="valueGrid"></td>
          </tr>
      </table>
	</body>
</html>
© 2009 JScriptSuite. All rights reserved.