/// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IApp page)
        {
            Action getData = async delegate
            {
                var dt = await GetDataTable();

                var dg = new DataGridView();
                dg.DataSourceChanged += delegate
                {
                    Console.WriteLine(new { DataSourceChangedEvent = "Inside Datagridsource changed" });
                    //foreach (var i in dg.Columns)
                    //{
                    //    Console.WriteLine(new { i });
                    //}
                    dg.Columns["Foo"].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;

                    Console.WriteLine(dg.Columns["Foo"].Width.ToString());
                    dg.Columns["Foo"].Width = 0;
                };
                dg.AttachControlToDocument();
                dg.DataSource = dt;
                dg.DataMember = "Sheet1";
            };

            getData();
        }
Beispiel #2
0
        public static async Task <DataGridView> AttachDataGridViewToDocument(this Task <DataTable> data)
        {
            // tested by
            // X:\jsc.svn\examples\javascript\appengine\DataGridWithHeaders\DataGridWithHeaders\Application.cs

            var x = await data;

            var grid = new DataGridView();


            grid.DataSource = x;

            grid.AttachControlToDocument();

            Native.document.title = x.TableName;

            return(grid);
        }