|
| |
ASP DataGridColumns .NET assembly (for VB.NET, C#, J#)
|
|
|
Obviously, your task is to create a database connection and command that binds data to an ASP .NET DataGrid server control. Also you need provide your users with a friendly interface.
|
One of the most permanent challenges in designing user interfaces is figuring out how to display large amounts of data efficiently and intuitively without bewildering the user. The problem becomes particularly thorny when the interface must give the ability to easily update and store the data that the user needs to modify.
The ASP .NET DataGrid control gives developers a powerful and flexible tool to meet this challenge. You do not need to look for some third-vendors’ costly datagrids. The ASP .NET DataGrid server control is smart enough.
|
|
ASPDataGridColumns .NET assembly from RustemSoft is a DataGrid Columns software package specifically designed for ASP .NET developers. The assembly allows you to use all strengths of the .NET DataGrid server control without waiving the user interface elements your customers need.
|
FREEWARE
|
|
The downloadable samples explain ASP .NET DataGrid control basic operations and show how to extend it to display different kinds of data columns in an application-appropriate manner.
By using the assembly you can create your own set of DataGrid Columns objects that defines custom columns for the ASP .NET DataGrid server control.
|
|
|
A column is an object that defines what the column looks and behaves like, including such things as color, font, and the presence of controls that will handle linked field in a database with the use of a Combo Box, a Check Box and other control.
The RustemSoft ASP DataGrid Columns assembly contains a special DataGridCommands class that allows you to manage a DataGrid's datasource. The ASPDataGridColumns dynamic link library contains the following DataGrid Columns:
|
Let's examine the very basics of ASP .NET DataGrid Columns usage - how to plop the columns down on an ASP.NET Web page and display bound database results.
|
|
VB .NET
' Save datagrid data source tableDataSource table
Dim DGCommands As DataGridCommands = New DataGridCommands()
DGCommands.UpdateDataSource(tableDataSource, yourDataGrid)
C#
// Save datagrid data source tableDataSource table
DataGridCommands DGCommands = new DataGridCommands();
DGCommands.UpdateDataSource(tableDataSource, yourDataGrid);
|
|
|
By clicking the "Save" button your user will be able to save all updates into DataGrid's datasource data object.
|
|
|
VB .NET
' Define comboCompany variable as an object of ComboBoxColumn class
' and assign it to the DataGrid1 'Company' column.
Dim comboCompany As ComboBoxColumn = DataGrid1.Columns(5)
' Define Name of Interface Page that will be called by clicking on ComboBox button
comboCompany.InterfacePageName = "ComboInterfacePage.aspx"
|
' Define width of Interface Page
comboCompany.InterfacePageWidth = 290
' Define height of Interface Page
comboCompany.InterfacePageHeight = 400
' Assign DataSource property for comboCompany object as tblCompanies
' data table where Companys’s names are stored.
comboCompany.DataSource = tblCompanies
' Specify DisplayMember as "Name" field of tblCompanies table
comboCompany.DisplayMember = "Name"
' Specify ValueMember as "PubID" field of tblCompanies table
comboCompany.ValueMember = "PubID"
' Identify "Company" column's foreground color
comboCompany.ForeColor = Color.DarkMagenta
' Identify "Company" column characters' font and size
comboCompany.Font_Name = "Tahoma"
comboCompany.Font_Size = FontUnit.Point(8)
' Adjust "Company" column's width
comboCompany.Width = Unit.Point(60)
C#
// Define comboCompany variable as an object of ComboBoxColumn class
// and assign it to the DataGrid1 'Company' column.
ComboBoxColumn comboCompany = (ComboBoxColumn)DataGrid1.Columns[5];
|
|
|
// Define Name of Interface Page that will be called by clicking on ComboBox button
comboCompany.InterfacePageName = "ComboInterfacePage.aspx";
// Define width of Interface Page
comboCompany.InterfacePageWidth = 345;
// Define height of Interface Page
comboCompany.InterfacePageHeight = 400;
// Assign DataSource property for comboCompany object as tblCompanies
// data table where Companys’s names are stored.
comboCompany.DataSource = tblCompanies;
// Specify DisplayMember as "Name" field of tblCompanies table
comboCompany.DisplayMember = "Name";
// Specify ValueMember as "PubID" field of tblCompanies table
comboCompany.ValueMember = "PubID";
// Identify "Company" column's foreground color
comboCompany.ForeColor = Color.DarkMagenta;
// Identify "Company" column characters' font and size
comboCompany.Font_Name = "Tahoma";
comboCompany.Font_Size = FontUnit.Point(8);
// Adjust "Company" column's width
comboCompany.Width = Unit.Point(60);
|
Syntax
<RustemSoft:TextBoxColumn DataField="Data Field Name" HeaderText="Header Text"/>
|
VB .NET
' Define TxtBox variable as an object of TextBox Column class
' and assign it to the DataGrid1 "City" column.
Dim TxtBox As TextBoxColumn = DataGrid1.Columns(2)
' Identify "City" column's foreground color
TxtBox.ForeColor = Color.DarkMagenta
' Identify "City" column characters' font and size
TxtBox.Font_Name = "Tahoma"
TxtBox.Font_Size = FontUnit.Point(8)
' Adjust "City" column's width
TxtBox.Width = Unit.Point(60)
C#
// Define TxtBox variable as an object of TextBox Column class
// and assign it to the DataGrid1 "City" column.
TextBoxColumn TxtBox = (TextBoxColumn)DataGrid1.Columns[2];
// Identify "City" column's foreground color
TxtBox.ForeColor = Color.DarkMagenta;
// Identify "City" column characters' font and size
TxtBox.Font_Name = "Tahoma";
TxtBox.Font_Size = FontUnit.Point(8);
// Adjust "City" column's width
TxtBox.Width = Unit.Point(60);
|
|
|
ASP DataGrid CheckBox Column
VB .NET
' Define CheckBox variable as an object of CheckBox Column class
' and assign it to the DataGrid1 'YesNo' column.
Dim CheckBox As CheckBox Column = DataGrid1.Columns(5)
C#
// Define CheckBox variable as an object of CheckBox Column class
// and assign it to the DataGrid1 'YesNo' column.
CheckBox Column CheckBox = (CheckBox Column)DataGrid1.Columns[5];
|
ASP DataGrid DateTime Column
| |
You have a DataGrid with a DateTime field that displays the date/time as "2/20/2005 7:00:00 PM". You would like to display only the time in the following format "7:00 PM". You would like to insert a new time in the column or update current time value only. Let us suppose that you are European and would like to see in date field something like "20.02.2005". The ASP DataGrid DateTime Column can help you design the concept that will resolve your needs.
The DateTime Column is used to allow the user to insert formatted date and time, and to display that date/time in your ASP DataGrid server control interface.
|
The ASP DataGrid DateTime Column class has the following useful properties:
Format - Various formats may be set. You may use a date/time format (like MMDDYY, MMDDYYYY, DDMMYY, DDMMYYYY, YYYYMMDD, HHMM12, HHMMSS12, HHMM24, HHMMSS24) to enable the date/time inserting and updating. Default is MMDDYYYY.
DefaultValue - any DateTime value. For example, you can set the DefaultValue to today's date. Default is empty DateTime (null/Nothing).
DelimiterChar - a separator between date/time fractions (between days and month or hours and minutes). Default is "/".
|
|
How to turn off error messages? How to define error messages in my native language?
VB .NET
' You may turn error messages off
DateTime.ErrMessageVisible = False
' You can specify an error message in your native language:
DateTime.ErrMessage = "Date Inadmissible ! Réintroduisez svp."
C#
// You may turn error messages off
DateTime.ErrMessageVisible = false;
// You can specify an error message in your native language:
DateTime.ErrMessage = "Date Inadmissible ! Réintroduisez svp.";
|
ASP DataGrid Numeric Column
How to turn off error messages? How to define error messages in my native language?
VB .NET
' You may turn error messages off
Percent.ErrMessageVisible = False
' You can specify an error message in your native language:
Percent.ErrMessage = "Date Inadmissible ! Réintroduisez svp."
C#
// You may turn error messages off
Percent.ErrMessageVisible = false;
// You can specify an error message in your native language:
Percent.ErrMessage = "Date Inadmissible ! Réintroduisez svp.";
|
ASP DataGrid Text Fractions Column
| |
This formatted intelligent ASP .NET DataGrid Text Fractions Column can mask the text fractions. It gives you ability to manage the IP Address, SS#, Phone numbers, etc., and checks the validation, and automatically set the delimiter location.
The TextFractionsColumn class is useful in several situations. For example, this control will automatically format a telephone number so when a user enters their phone number like this:
123-456-7890
or
1234567890
it will automatically change the numbers in the column text updating box.
Up to 5 text fractions can be defined. By setting the DelimiterChar property up a delimiter symbol for the control can be specified. You can define the overall length of each text fraction and what kind of characters can be inserted in the fraction (alphanumeric, numeric only, etc.).
|
|
To identify each text fraction you must set values of two-dimensional array where properties of the fractions are stored. The first array's element specifies what characters can be inserted into the fraction. It accepts the following values:
N - numeric characters (0-9) are acceptable only
L - letters (Aa-Zz) are acceptable only
A - alphanumeric characters (Aa-Zz0-9) are acceptable only
Empty - any characters are acceptable
The second array's element specifies overall fraction's length.
|
By implementing in your code an interface with the DataGridCommands class you will be able to save all updates into DataGrid's datasource data object. By using UpdateDataSource method of the class you can easily save all updates that your user made in ASP DataGrid Text Fractions Column into bound datasource.
Syntax
<RustemSoft:TextFractionsColumn DataField="Data Field Name" HeaderText="Header Text"/>
|
VB .NET
' Define PhoneColumn variable as an object of TextFractionsColumn class
' and assign it to the DataGrid1 'Phone' column.
Dim PhoneColumn As TextFractionsColumn = DataGrid1.Columns(5)
' Identify 'Phone' column's foreground color
PhoneColumn.ForeColor = Color.DarkMagenta
' Identify 'Phone' column characters' font and size
PhoneColumn.Font_Name = "Tahoma"
PhoneColumn.Font_Size = FontUnit.Point(8)
' Adjust 'Phone' column's width
PhoneColumn.Width = Unit.Point(60)
' Specify Delimiter Character for the field as space
PhoneColumn.DelimiterChar = " "
' Specify first fraction properties
' Alphanumeric symbols only are acceptable for the fraction
PhoneColumn.FractionsCode(0, 0) = "a"
' You can insert 3 symbols only into the first fraction
PhoneColumn.FractionsCode(0, 1) = 3
' Specify second fraction properties
' Numeric symbols only are acceptable for the fraction
PhoneColumn.FractionsCode(1, 0) = "n"
' You can insert 3 symbols only into the second fraction
PhoneColumn.FractionsCode(1, 1) = 3
' Specify third fraction properties
' Numeric symbols only are acceptable for the fraction
PhoneColumn.FractionsCode(2, 0) = "n"
' You can insert 4 symbols only into the third fraction
PhoneColumn.FractionsCode(2, 1) = 4
' Define PhoneColumn column’s error message for max value
PhoneColumn.ErrMessageMaxValue = "Not correct phone #!"
C#
// Define PhoneColumn variable as an object of TextFractionsColumn class
// and assign it to the DataGrid1 'Phone' column.
TextFractionsColumn PhoneColumn = (TextFractionsColumn)DataGrid1.Columns[5];
// Identify 'Phone' column's foreground color
PhoneColumn.ForeColor = Color.DarkMagenta;
// Identify 'Phone' column characters' font and size
PhoneColumn.Font_Name = "Tahoma";
PhoneColumn.Font_Size = FontUnit.Point(8);
// Adjust 'Phone' column's width
PhoneColumn.Width = Unit.Point(60);
// Specify Delimiter Character for the field as space
PhoneColumn.DelimiterChar = " ";
// Specify first fraction properties
// Alphanumeric symbols only are acceptable for the fraction
PhoneColumn.FractionsCode[0, 0) = "a";
// You can insert 3 symbols only into the first fraction
PhoneColumn.FractionsCode[0, 1] = 3;
// Specify second fraction properties
// Numeric symbols only are acceptable for the fraction
PhoneColumn.FractionsCode[1, 0] = "n";
// You can insert 3 symbols only into the second fraction
PhoneColumn.FractionsCode[1, 1] = 3;
// Specify third fraction properties
// Numeric symbols only are acceptable for the fraction
PhoneColumn.FractionsCode[2, 0] = "n";
// You can insert 4 symbols only into the third fraction
PhoneColumn.FractionsCode[2, 1] = 4;
// Define PhoneColumn column’s error message for max value
PhoneColumn.ErrMessageMaxValue = "Not correct phone #!";
|
How to turn off error messages? How to define error messages in my native language?
VB .NET
' You may turn error messages off
PhoneColumn.ErrMessageVisible = False
' You can specify an error message in your native language:
PhoneColumn.ErrMessage = "Date Inadmissible ! Réintroduisez svp."
C#
// You may turn error messages off
PhoneColumn.ErrMessageVisible = false;
// You can specify an error message in your native language:
PhoneColumn.ErrMessage = "Date Inadmissible ! Réintroduisez svp.";
|
ASP DataGrid Text Edit Column
| |
The RustemSoft ASP DataGrid TextEdit Column gives you a useful TextEdit Field control, which presents an edit window when user selects a cell of the ASP DataGrid TextEdit Column on .NET DataGrid. This provides a pop-up TextEdit field editor that you can call from your code at any time to let users edit the text in a TextEdit field.
This Text Edit field editor provides more flexibility by updating the TextEdit field to be used in an ASP .NET DataGrid server control's column.
The ASP DataGrid Text Edit Column TextEdit field editor is useful for showing short document contents, like Memos and emails.
When using the DataGrid TextEdit Column editor you are automatically provided with all general features, which any typical, contemporary word processor has.
|
|
ASP DataGrid UpDown Column
|
|
The RustemSoft ASP DataGrid UpDown Column represents a datagrid column up-down control that displays a list's selected values. It allows you to show a UpDown control in a Datagrid cell. The control displays in a datagrid cell a single value that is selected from a collection by clicking the up or down buttons of the control. The user can also enter text in the control if the string typed in matched an item in the collection to be accepted.
To create a collection of objects to display in the UpDown control, you can add or remove the items individually by using the Add and Remove methods.
You can identify a DataSource parameter for the control. The DataSource is a source for DataGrid UpDown column values list as System.Data.DataTable or System.Data.DataRowView or System.Collections.ArrayList. By defining DisplayMember parameter you can specify a field to display in UpDown column as String (name of table column).
Use the ASP DataGrid UpDownColumn to create a single selection up-down list control in each cell of ASP .NET DataGrid column. You can control the appearance of the ASP DataGrid UpDownColumn by setting the BackColor, ForeColor, BorderColor, BorderStyle, and other properties.
The ASP DataGrid UpDownColumn supports data binding. To bind the control to a data source, create a data source, such as a System.Collections.ArrayList object, that contains the items to display in the column. Then, use the DataSource property to bind the data source to the ASP DataGrid UpDownColumn. You can use a DataTable object as a datasource for your UpDownColumn. For this kind of a datasource you need to specify ValueMember and DisplayMember properties.
|
|