460 likes | 1.01k Views
Sybase DataWindow .NET. John Strano john.s.strano@sybase.com Technology Evangelist Sybase, Inc. Agenda. Overview of DataWindow .NET Windows Forms Demonstration Web Forms Demonstration Q&A Session. Introducing DataWindow .NET. One component for data access and reporting
E N D
Sybase DataWindow .NET John Strano john.s.strano@sybase.com Technology Evangelist Sybase, Inc.
Agenda • Overview of DataWindow .NET • Windows Forms Demonstration • Web Forms Demonstration • Q&A Session
Introducing DataWindow .NET • One component for data access and reporting • Greatly reduces the amount of code you need to write in a .NET application • Intuitive graphical user interface allows developers to be productive immediately • Patented technology backed up by award-winning customer support • Supports Microsoft® Windows forms, Web forms, and Microsoft® Windows Mobile-based® Tablet PC applications
DataWindow .NET Award Nomination
What is DataWindow .NET? • DataWindow .NET consists of: • A Component that plugs into your .NET development environment • A DataWindow Designer that allows you to graphically create your data presentation layer • A Database Administration Tool to access and graphically display database information • Database drivers to access your RDBMS of choice
What is DataWindow .NET? • At runtime DataWindow .NET consists of: • Data entry interfaces • Reports • Engine that tracks user modifications and dynamically generates INSERTs, UPDATEs and DELETEs …all from one tool.
Introducing DataWindow .NET • Presentation Styles
Introducing DataWindow .NET • Additional Features
Drop Down DataWindows Think of them as enhanced Combo Boxes
Validation rule files DataWindow Validation Rules
DataWindow .NETMore Information • Over 1000 properties that can be accessed and manipulated at both design time and runtime • Approximately 200 methods to access and control data and the DataWindow • Lots of events for even greater control • ItemChanged, ItemError, SQLPreview, RowFocusChanged, etc.
DataWindow .NETMore Information • Edit Masks and formatting • Computed Fields for client-side processing • Supports SQL, stored procedures and external data sources • Easy printing of DataWindows ( dwc.Print() ) • Dynamic creation of DataWindows at runtime • And much more!
Reduce CodeExample: Setting the Autosize Height on a Row • public void AutoSizeGrid() { // DataGrid should be bound to a DataTable for this part to // work. int numRows = ((DataTable)gridTasks.DataSource).Rows.Count; Graphics g = Graphics.FromHwnd(gridTasks.Handle); StringFormat sf = new StringFormat(StringFormat.GenericTypographic); SizeF size; // Since DataGridRows[] is not exposed directly by the DataGrid // we use reflection to hack internally to it.. There is actually // a method get_DataGridRows that returns the collection of rows // that is what we are doing here, and casting it to a System.Array MethodInfo mi = gridTasks.GetType().GetMethod("get_DataGridRows", BindingFlags.FlattenHierarchy | BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); System.Array dgra = (System.Array)mi.Invoke(gridTasks,null); // Convert this to an ArrayList, little bit easier to deal with // that way, plus we can strip out the newrow row. ArrayList DataGridRows = new ArrayList(); foreach (object dgrr in dgra) { if (dgrr.ToString().EndsWith("DataGridRelationshipRow")==true) DataGridRows.Add(dgrr); } // Now loop through all the rows in the grid for (int i = 0; i < numRows; ++i) { // Here we are telling it that the column width is set to // 400.. so size will contain the Height it needs to be. size = g.MeasureString(gridTasks[i,1].ToString(),gridTasks.Font,400,sf); int h = Convert.ToInt32(size.Height); // Little extra cellpadding space h = h + 8; // Now we pick that row out of the DataGridRows[] Array // that we have and set its Height property to what we // think it should be. PropertyInfo pi = DataGridRows[i].GetType().GetProperty("Height"); pi.SetValue(DataGridRows[i],h,null); // I have read here that after you set the Height in this manner that you should // Call the DataGrid Invalidate() method, but I haven't seen any prob with not calling it.. } g.Dispose(); } DataGrid DataWindow
Reduce CodeExample: Setting a Column Style to Checkbox • // code assumes you have a DataSet named myDataSet, a table named "EastCoastSales" and a DataGrid myDataGrid //STEP 1: Create a DataTable style object and set properties if required. DataGridTableStyle ts1 = new DataGridTableStyle(); //specify the table from dataset (required step) ts1.MappingName = "EastCoastSales"; // Set other properties (optional step) ts1.AlternatingBackColor = Color.LightBlue; //STEP 2: Create a string column and add it to the tablestyle DataGridColumnStyle TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "custName"; //from dataset table TextCol.HeaderText = "Customer Name"; TextCol.Width = 250; ts1.GridColumnStyles.Add(TextCol); //STEP 3: Create an int column style and add it to the tablestyle //this requires setting the format for the column through its property descriptor PropertyDescriptorCollection pdc = this.BindingContext [myDataSet, "EastCoastSales"].GetItemProperties(); //now created a formated column using the pdc DataGridDigitsTextBoxColumn csIDInt = new DataGridDigitsTextBoxColumn(pdc["CustID"], "i", true); csIDInt.MappingName = "CustID"; csIDInt.HeaderText = "CustID"; csIDInt.Width = 100; ts1.GridColumnStyles.Add(csIDInt); //STEP 4: Add the checkbox DataGridColumnStyle boolCol = new DataGridBoolColumn(); boolCol.MappingName = "Current"; boolCol.HeaderText = "Info Current"; //uncomment this line to get a two-state checkbox //((DataGridBoolColumn)boolCol).AllowNull = false; boolCol.Width = 150; ts1.GridColumnStyles.Add(boolCol); //STEP 5: Add the tablestyle to your datagrid's tablestlye collection myDataGrid.TableStyles.Add(ts1); DataGrid DataWindow
Reduce CodeExample: Adding a Combo Box DataWindow DataGrid • // Step 1. Derive a custom column style from DataGridTextBoxColumn // a) add a ComboBox member // b) track when the combobox has focus in Enter and Leave events // c) override Edit to allow the ComboBox to replace the TextBox // d) override Commit to save the changed data // Step 2 - Use the combo column style // Add 1 col with combo style DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn(); ComboTextCol.MappingName = "custCity"; ComboTextCol.HeaderText = "Customer Address"; ComboTextCol.Width = 100; ts1.GridColumnStyles.Add(ComboTextCol); // Step 3 - Additional setup for Combo style // a) make the row height a little larger to handle minimum combo height ts1.PreferredRowHeight = ComboTextCol.ColumnComboBox.Height + 3; // b) Populate the combobox somehow. It is a normal combobox, so whatever... ComboTextCol.ColumnComboBox.Items.Clear(); ComboTextCol.ColumnComboBox.Items.Add("Chicago"); ComboTextCol.ColumnComboBox.Items.Add("Corvallis"); ComboTextCol.ColumnComboBox.Items.Add("Denver"); ComboTextCol.ColumnComboBox.Items.Add("Great Falls"); ComboTextCol.ColumnComboBox.Items.Add("Kansas City"); ComboTextCol.ColumnComboBox.Items.Add("Los Angeles"); ComboTextCol.ColumnComboBox.Items.Add("Raleigh"); ComboTextCol.ColumnComboBox.Items.Add("Washington"); // c) set the dropdown style of the combo... ComboTextCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList; Note: For data from a database even more code would be required!
Demonstration One Windows Forms
Demonstration Two Web Forms
Demonstration Four dw-eXtreme.com “Planner”
Session Summary • Provided an overview of DataWindow .NET features • Demonstrated how DataWindow .NET can be used in .NET Windows Forms applications • Demonstrated how DataWindow .NET can be used in ASP.NET applications
Roadmap for DataWindow .NET • DataWindow .NET 1.5 • WebForms and ASP .NET • Direct access to DataWindow object properties using the DataWindow .NET object model • Ink Edit and Ink Picture Controls • General availability April 8, 2005 • DataWindow .NET 2.0 • Support for .NET Datasets and DataTables • Additional ADO .NET support • Integrate DataWindow Designer into the Microsoft® Visual Studio® IDE • Support for Microsoft® .NET Framework 2.0 and ASP .NET 2.0 • Release planned for late 2005
DataWindow .NETResources • Newsgroup: • Forums.sybase.com – sybase.public.datawindow.net • http://www.sybase.com/support/newsgroups • Blogs: • http://www.teamsybase.net/blogs • Code Examples: • http://datawindownet.codexchange.sybase.com • Product Information and Evaluation Copy: • http://www.sybase.com/datawindow.net • Replay of MSDN live webcast: • http://www.microsoft.com/events/webcasts/library/200503.mspx • DataWindow .NET 1.5 Evaluation Download • http://response.sybase.com/forms/dwnet15eval
Questions and Answers • Q&A • John.S.Strano@Sybase.com