Components of Px Framework:
PxCheckBox - component for checking the value (Check / UnCheck value)
The PxCheckBox component works similarly to or has got similar properties as the PxEdit
component. Therefore there is no need in their detailed description, for the details please refer to
the chapter about the PxEdit component. Things that have been described in detail in case of the
PxEdit component shall only be mentioned here.
The PxCheckBox component enables automatic editing of the table row column, which is loaded in
the PxWebQuery component. Create the AddAdresar.aspx file, and type the following definition of
the PxCheckBox component there:
AddAdresar.aspx file::
<Prx:PxCheckBox ID="chkInvalid_Adress" runat="server" AddTableRow="True"></Prx:PxCheckBox>
In the AddAdresar.aspx.cs file, define linking of the PxCheckBox component to the PxWebQuery
component and its linking to the specific table column.
AddAdresar.aspx.cs file::
protected void Page_Load(object sender, EventArgs e)
{
chkInvalid_Adress.PxDataSource = wquAdresar;
chkInvalid_Adress.FieldName = "Invalid_Adress";
}
The PxCheckBox component supports automatic loading of value from the PxWebQuery
component and automatic saving of the entered value to the database, while executing the Post()
command at the PxWebQuery component. Thus, as the PxCheckBox component allows to select
only two states, i.e. True or False, it is possible to specify at the PxWebQuery component, the way
these states shall be displayed and saved to the database. The parameter with the
AddParamCheck
parameter method is used for such definition. The
AddParamCheck method is the PxWebQuery
component method.
Description of the parameters of the AddParamCheck method:
C# syntax:
public void AddParamCheck(string aFieldName,
string aCheckedValue, string aUnCheckedValue,
bool aEditReadOnly)
Description of the parameters:
aFieldName - name of the column in the table to which the AddParamCheck method is applied
aCheckedValue - String value that shall replace the "True" value, during selection in the PxCheckBox component
aUnCheckedValue - String value that shall replace the "False" value, during selection in the PxCheckBox component
aEditReadOnly - If the grid is in the "edit" state and the value entered is "True" the editing operation shall be allowed
After applying the
AddParamCheck parameter to the PxWebQuery component and linking the
PxCheckBox component, this component can automatically interpret data loaded from the
database during the loading process and automatically save the defined string value to the database
during the saving process.
In this, the definition of the
AddParamCheck parameter shall be as follows:
wquAdresar.AddParamCheck("invalid_adress", "A", "N", false);
This definition can be written to the Adresar.aspx.cs file, and it shall be as follows:
protected void Page_Load(object sender, EventArgs e)
{
if ((!IsPostBack)&&(wquAdresar.Active==false))
{
string sSQLText1 = "select IDPravForm as Key, Name as Value from PravForm Order By Value";
wquAdresar.ConnectString = "User Id=skodapeter;Password=aa;Data Source=xe;";
wquAdresar.SQLSelect = @"select idadresar,name,address,idpravnaforma,create_date,invalid_adress
from Adresar02";
wquAdresar.AddParamKey("idpravnaforma", "Key", "Value", "Value", "Key", sSQLText1);
wquAdresar.AddParamCheck("invalid_adress", "A", "N", false);
wquAdresar.Open();
wquAdresar.Columns["idadresar"].Caption = "ID";
wquAdresar.Columns["name"].Caption = "Persons Name";
wquAdresar.Columns["idpravnaforma"].Caption = "Juridical form";
wquAdresar.Columns["address"].Caption = "Address";
wquAdresar.Columns["create_date"].Caption = "Date of Establishment";
wquAdresar.Columns["invalid_adress"].Caption = "Invalid address";
}
else
{
}
grdAdresar.PxDataSource = wquAdresar;
grdAdresar.DataBind();
}
After entering or applying of AddParamCheck parameter to the PxWebQuery component, the
PxSuperGride component shall display values , instead of the "True" value the "A" value shall be
displayed and instead of the "False" value the "N" value shall be displayed. Entry to the database
shall be carried out in the similar way.
For more details please refer to the image below:
The AddAdresar.aspx form shall look like as follows:
The AddTableRow, TableBegin and TableEnd properties, which are described in detail in the
section dealing with the PxEdit component, are used once again for the alignment of the
component.
Caption name or titles of the columns in the Grid can be defined centrally, during the definition of
the PxWebQuery component, where the value in square brackets is the name of the column:
wquAdresar.Columns["invalid_adress"].Caption = "Invalid address";
Changing the PxCheckBox (Label) caption:
Besides central definition, the PxCheckBox component caption can be changed in the following
way:
chkInvalid_Adress.Text = "Invalid address 2";
Here is a functional example of the PxCheckBox component, even with source code.
This functional example on this site runs on MySQL 5.0 database.
Others articles of Px Framework:
- PxWebQuery - component for working with databases
- PxSuperGrid - component for the direct display of data in the table
- PxEdit - component for data editing, similar to the TextBox component
- PxComboBox - component for selecting data from a list, similar to the DropDownList component
- PxCheckBox - component for checking the value (Check / UnCheck value)
- PxFlyComboBox - set of the consecutively linked comboboxes, suitable for the work with structured data (for example: selection of category and subcategory)
- PxGreatRepeater - component for entering data with repeating structure, maximum number of values is limited
- PxJSDatePicker - component for the date entry, based on the JavaScript
- PxDbNavigator - the component for the work with the PxWebQuery components, row cursor movement, etc.
- PxLabel - component for data display
- PxCheckBoxList - component to view and select values from the list
- PxRadioButtonList - component for view and selection of a value from the list
- PxChart - the component for displaying and working with charts
- PxFilterView - visual component for filtering the table data contents in the PxWebQuery component
- PxUploader - component for uploading binary and text files to the server
- PxLogin - component for authorization and logging into the application
- Data loading from the Oracle, MSSQL, MySQL, FireBird, Interbase database by means of the PxWebQuery components
- Program inserting, editing or deleting of row into the database by means of the PxWebQuery component
- Loading values from the PxWebQuery component via the while cycle
- Row search in the PxWebQuery component according to the value entered and the name of the column where the search shall be carried out
- The "ReOpen" procedure of the PxWebQuery component and data re-load into the PxWebQuery component
- Validation, checking of the entered values by means of the PxWebQuery component and other visual components (PxEdit, PxComboBox, etc.)
- Events of the PxWebQuery component
- A special function GetValueFromStructKey of the PxWebQuery component
- Setting the language mutation of the Px Framework
- Finding the current version of the Px Framework
It doesn't the intention of this part website, describe in detail the work with PxFramework components, a detailed description of the component
available in manual, which can be downloaded here:
Download manual of Px Framework