en_lang.jpg, 1 kB sk_lang.jpg, 1 kB
English Slovak

      Px Framework - ASP.NET components for rapid development of database applications


Menu:



Components of Px Framework:


PxCheckBoxList - component to view and select values from the list



The PxCheckBoxList component has many similar properties such as PxEdit component.
Therefore, it makes no sense to describe them in details, you can read the chapter on the PxEdit component.
Things that were described in detail when dealing with the PxEdit component, we will pass here only by telegraph, briefly.

With the PxCheckBoxList component we can automatically edit a column of a row in the table, which is loaded in PxWebQuery component. We create a file AddAdresar.aspx, and write the following definition of PxCheckBoxList component into the file:

AddAdresar.aspx file:

<Prx:PxCheckBoxList ID="chlCar" runat="server" AddTableRow="True" />


In AddAdresar.aspx.cs file we define the connection PxCheckBoxListu components with the PxWebQuery component, and its link to a specific table column.

AddAdresar.aspx.cs file:

protected void Page_Load(object sender, EventArgs e)
{
   chlCar.PxDataSource = wquAdresar;
   chlCar.FieldName = "Z_COLOR";
}


The PxCheckBoxList component supports automatic loading of value from the PxWebQuery component, and automatic storage of selected value into the database after execution of the Post() command on the PxWebQuery component.

Because the PxCheckBoxList component enables to select a single item from the list it is possible to select (enter) on the PxWebQuery component how these conditions are displayed and entered into the database. For the definition the parameter named method AddParamCheckList is used. The AddParamCheckList method is a method of PxWebQuery component.

Description of the parameters of the AddParamCheckList method:
C# syntax:

public void AddParamCheckList(string aFieldName, string aFieldNameKey, string aFieldNameValue, string aFieldToView, string aFieldToDB, string aPxWebQueryName)

public void AddParamCheckList(string aFieldName, string aFieldNameKey, string aFieldNameValue, string aPxWebQueryName)


Description of the parameters:

aFieldName - name of a column in the table on which method AddParamCheckList is applied. The best way is to assign the size varchar (500) to this column in the database.
aFieldNameKey - name of the code list column that represents the key of the code list (the name of this column can be detected from the SQL command that is entered into the PxWebQuery component in which the code list is loaded)
aFieldNameValue - name of the code list column that represents the value of the code list column (the name of this column can be detected from the SQL command that is entered into PxWebQuery component in which the code list is loaded)
aFieldToView - the name of the column which value will be diplayed will be displayed in the Grid (PxSuperGrid) is entered here when selecting multiple items, these items are displayed separated by commas in the Memo component (TextBox).
aFieldToDB - the name of the column which value will be entered into the database is entered here when selecting multiple items, these items are entered one after the other and are separated by commas.
aPxWebQueryName -name of the PxWebQuery component in which the command code list is loaded via SQL, it is suitable to properly identify each column as Key and Value, for greater clarity


Example of AddAdresar.aspx.cs file in the Page_Load method:

wquAkcia.AddParamCheckList("Z_COLOR", "IDCOLOR", "COLOR_NAME", "wquListOfColor");


After the imposition of the parameter AddParamCheckList to the PxWebQuery component and connection of the component PxCheckBoxList, this component can automatically load data from the parameter and the selected value is automatically saved into the database.

Image components PxCheckBoxList


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 components.

Caption name or titles of the columns in the Grid (Title) 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["COLOR_NAME"].Caption = "Color Name";


Changing the PxCheckBoxList (Label) caption:
Besides central definition, the PxCheckBoxList component caption can be changed in the following way:

chlCar.Caption = "Color Name 2";


The PxCheckBoxList component has OnlyCheckBoxList property, that enables to display the PxCheckBoxList component in two ways, if it is not in the state of editing.
If the value True is entered into the property OnlyCheckBoxList the component is displayed as a CheckBoxList as in the state of editing.
If the value False is entered into the property OnlyCheckBoxList the component is displayed as Memo (TextBox), and selected individual values are entered in a row and separated by a comma as shown in the picture below.

Image components PxCheckBoxList-OnlyCheckBoxList

chlCar.OnlyCheckBoxList = false;


Through the SeparatorSumText property of the component PxCheckBoxList we can control visual display of the values separator when it is displayed in the Memo component (TextBox) and entered into the database.
The default value is comma "," or you can type a semicolon ';'.

chlCar.SeparatorSumText = ",";


The PxCheckBoxList component allows filtering of displayed content of the code list through the Filter property. The names of the code list columns (fields) of the PxWebQuery component are used in the Filter property.

chlCar.Filter = "CurrentState=1";


After entering this command only those items that have in the code list column of the PxWebQuery titled "CurrentState" given value "1" are displayed in the PxCheckBoxList component.


Others articles of 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